Welcome to the floatflt package!

Mats Dahlgren

                       (matsd@physchem.kth.se)

1995/02/09

Abstract The floatflt package is an extension of Thomas Kneser’s style option floatfig.sty for L^{A}TEX 2.09. The extension was done by Mats Dahlgren (matsd@physchem.kth.se). This document describes the use of floatflt version 1.2.1 (1995/02/14). This file and the package: Copyright \begin{matrix}c \\ ◯ \end{matrix} 1994-1995 by Mats Dahlgren. All rights reserved.

1 Introduction

The file floatflt.sty defines two environments: floatingfigure and floatingtable. In prin-

ciple the two environments work the same way and do the same job, but there are some important differences, which are explained below. The general idea is that a figure or table which is not very wide should be allowed to have regular text typsetted beside itself. In Thomas Kneser’s file floatfig.sty and in the documentation thereof, such figures are called floating figures. In the floatflt package, the term floating is generally used for such figures and tables, despite the slight different use of the term float in L^{A}TEX. Hence the term floating floats for such figures and tables.

1.1 For floatfig.sty users

There are five major differences in the use of floatflt as compared to floatfig:

• The extension to the floattable environment.

• There is no longer any need for initialization, thanks to the \AtBeginDocument command.

• Optional arguments for the environments wihch allows the user to place the floating floats left, right or according to the page number (as with floatfig.sty); this is mainly due to the possibility to have optional arguments in newly defined environments.

• Optional argument for the package as a whole if the user wants to force all floating floats to be to the right or left. The placement option at \begin{floatingfigure} (and \begin{floatingtable}) overrides this (and there is also the optional placement option to re-introduce the page-number dependent placement for one figure or table).

• Compatibility with the multicol tool package is now obtained.

2 “Userguide”

In the following, the usage of the package is explained in some detail. Users who are unfamiliar with the floatfig.sty package by Thomas Kneser may also find it useful to run L^{A}TEX on the file

floatfge.tex.

2.1 How to call the package

The floatflt package is activated by the following line in your L^{A}TEX input file following your

\documentclass command:
   \usepackage[option]{floatflt}

The option may be either one of the following: rflt, lflt, or vflt.

2.1.1 The package options

The three package options have the following functions:

rflt Forces the default for the floating figures and tables to be typset to the right in a paragraph.

lflt Forces the default for the floating figures and tables to be typset to the left in a paragraph.

vflt Forces the floating figures and tables to be typset to the right in a paragraph on odd-nubered pages, and to the left on even-numbered pages; this is also the default.

The option vflt is actually not needed and does nothing but tells L^{A}TEX to use the default, it is also the internal default. It is supported for symmetry reasons with the optional arguments for the environments temselves.

2.2 How to use the floatingfigure environment

In your L^{A}TEX document you invoke the floatingfigure environment by typing:

   \begin{floatingfigure}[option]{width}

figure commands with or without \caption

   \end{floatingfigure}

The option may be either one of the following: r, l, p, or v. The quantity width is the width you want your floating figure to have (such as “75mm”).

2.2.1 The floatingfigure options

The options to the floatingfigure environment all overrule any present package option which may be in effect. The options have the following functions:

r Forces the current floating figure to be typset to the right in a paragraph.

l Forces the current floating figure to be typset to the left in a paragraph.

p Forces the current floating figure to be typset to the right in a paragraph if the pagenumber is odd, and to the left if even.

v Applies the package option to the current figure, and if no package option is specified, it forces the current floating figure to be typset to the right in a paragraph if the pagenumber is odd, and to the left if even.

The p option is used when the default alternating right/left typesetting of floating figures is desired despite the use of the rflt or lflt package option. The v option is the internal default, and does not have any effect other than applying either the default or the option specified for the whole package.

2.3 How to use the floatingtable environment

In your L^{A}TEX document you invoke the floatingtable environment by typing:

   \begin{floatingtable}[option]{
   \begin{tabular}{tabular specifiers}

here you put your table entries

   \end{tabular}}

\caption if desired

   \end{floatingtable}

The option may be either one of the following: r, l, p, or v. No specification of the width is explicitly made, instead the whole tabular environment is a mandatory argument. Thus, it is important to always have the “{” before \begin{tabular}... and the “extra” “}” after \end{tabular}. At the present, tabbing environment can not be used in the floatingtable environment. (Other commands and environments such as the \parbox command may be used instead of the tabular environment within a floatingtable environment.)

2.3.1 The floatingtable options

The options for the floatingtable environment are exactly the same as for the floatingfigure environment, and they also have the same effects.

2.4 Compatibility

The present version of floatflt has been tested with L^{A}TEX 2ε and TEX 3.1415 under Open VMS, using the article document class. As seen above, the regular \caption command of both the figure and tabular environments work fine. The \hangcaption command of David M. Jones

(dmjones@theory.lcs.mit.edu) does not work with floatflt. The use of \hangcaption gives

the same result as \caption. The listing commands \listoffigures and \listoftables also work properly. However, since floating figures and tables normally are typsetted in a paragraph, the order in the lists may be strange if also regular figure and table environments are used close to the floating ones.

Unlike floatfig.sty, floatflt works with the multicol tool package, provided the floating floats are still less wide than the columns. If not, or if the floating floats and the columns have almost the same width, text may dift away and overlap text in adjacent column(s). However, this combination has several restrictions, and the placement of the floating floats may not always be the correct according to the page numbering. Normally it also leads to many Underfull \hbox varnings. The use of this combination is discouraged.

2.5 Warnings and messages

In Thomas Kneser’s original work floatfig.sty, there are several warnings issued when problems occur. These are kept in floatflt. Warnings will be issued if if two floating figures, two floating tables, or if one floating table is colliding with one floating figure. Also, message(s) will be displayed if a floating float is moved from its original paragraph. Finally, each processed floating float will produce a message telling which page it has been typsetted on.

3 Known problems and limitations

The following problems and limitations are known:

• If a floating figure or table is called close to a sectioning command, the floating float may be lost or truncated. This may lead to a “collision warning”, which normally has to be analyzed “by hand”.

• If two consecutive paragraphs both contain a floating float, a “collision warning” is issued. This warning may be ignored.

• A floatingtable environment sometimes leads to a warning like:

        Overfull \hbox (10.78334pt too wide) in paragraph at lines 287--289

where the line numbers refered to are those of the \end{tabular} statement. This could not be avoided in all cases.

• If you use floating floats of different kinds close to each other in your input, you are likely to have problems. You may either lose one of the floating floats entirely, have it overwritten by the other, or have it truncated.

• L^{A}TEX has problem in linebreaking short lines. This may give you bad linebreaks in the captions of floating floats.

• There are some problems when a floating float and a footnote appear on the same page, especially when the floating float is moved to another page. Unfortunately, this may need some adjustments by hand. (Reported by Jakob Schiotz (schiotz@fysik.dtu.dk).)

• If a floating float is placed close to a list environment (such as enumerate or itemize), the text of the list environment is likely to overwrite the floating float. See section 3.1 below for a semi-automatic solution of this problem. (The bug was reported by Rafael Gallego

     (gallego@esi.us.es).)

The first two of these were pointed out by Thomas Kneser in the original documentation of

floatfig.sty.

3.1 How to Avoid the List Problem

There is a semi-automatic way to avoid the “List Problem” mentioned above. The solution was introduced in version 1.2. For items in a list which are colliding with a floating float, there is a special command \fltitem avaliable, which takes one mandatory argument. This command is to be used in place of the ordinary \item, and should have the text of the item as the argument. E. g. you would write

      \fltitem{text}

instead of

      \item text

to avoid the text of the \item command to be written in the floating float. \fltitem also takes a second, optional, argument, which is an extra vertical space put in after the text of the \fltitem command. This is meant to be used specially when there are two paragraphs in the same item text, and the latter is to use the full line width (i. e. when the item text ends below the floating float). So, the full syntax of the \fltitem command is:

     \fltitem[len]{text}

which inserts the extra vertical space len after the item text. If there is a second text which is to span the full linewidth in the same item, one would write:

\fltitem[len]{text1 } text2 which first typesets text1 narrowed according to the floating float, followed by text2 with full linewidth, and an extra vertical space len between these two texts.

There is also a second, analogous command \fltditem which takes two mandatory and one optional argument. The optional argument is the same as the optional argument of \fltitem, the first mandatory argument is the item label, e. g. the item to be described in a description environment. The second mandatory argument of \fltditem is the item text. The syntax of the \fltditem command is:

     \fltditem[len]{label}{text}

which produces an item with label label and text text and extra vertical space len after the item text. Additional text spanning the full linewidth may follow, just like with \fltitem, but the indentation may turn out to be strange.

   Both \fltitem and \fltditem can be used in an ordinary itemize, enumerate, or description

environment (however, the use of \fltditem in enumerate may produce strange results). For \fltitem and \fltditem to work properly, the (otherwise) colliding floating float must be set flush right, that is have the option r specified. The use of \fltitem or \fltditem is not demonstrated in the floatexm.tex file.

3.2 Sending a bug report

Reports of new bugs in the package are most welcome. However, I do not consider this to be a “supported” package. This means that there is no guarantee I (or anyone else) will put any effort into fixing the bug. But, on the other hand, someone may, so filing a bug report is always a good thing to do! (If nothing else, your discoveries may end up in future releases of this document.) Before filing a bug report, please take the following actions:

1. Ensure your problem is not due to your inputfile;

2. Ensure your problem is not due to your own package(s) or class(es);

3. Ensure your problem is not covered in the section “Known problems and limitations” above;

4. Try to locate the problem by writing a minimal L^{A}TEX 2ε input file which reproduces the

problem. Include the command

        \setcounter{errorcontextlines}{999}

in your input;

5. Run your file through L^{A}TEX 2ε;

6. Send a description of your problem, the input file and the log file via e-mail to:

     matsd@physchem.kth.se.

4 Conclusion

Without Thomas Kneser’s floatfig.sty as a base, I could never have written the floatflt package. I hope that some users will find the package useful and not too bugful. :–) Comments and suggestions for improvements are always most welcome!

Enjoy your L^{A}TEX!mats d.