The endfloat package^{∗}

James Darrell McCauley^{†}

1995/03/09

Abstract

The purpose of this style is to put all figures on pages by themselves at the end of an article in a section named Figures. Likewise for tables. Reference can be made in the text of where the figure should have been (only caption appears – see markers [default] and nomarkers options below. \ref and \label always work on the ones at the end). This is usually required when preparing submissions to journals.

Loading this package will change the output of L^{A}TEX.

1 In many voices

This documentation was put in its current form by Jeff Goldberg, who has tried to indicate when he is (when I am) speaking. See section 8 for more detail. However, both the original author, Darrell McCauley, and a major contributor, Brian Junker, use the first person singular. In this version I no longer work to keep it clear who wrote what portions of the documentation and the code, but have allowed things to blend together a little more, since the constant interpolations were hindering readability. Generally the user documentation was written by Darrell MaCauley (jdm), but anything that refers to L^{A}TEX 2ε features was added by me (jpg). Also, where you find spelling and typographical errors, you are likely to be reading my text.

2 Why write this package?

Many journals require tables and figures to be separated from the text when you submit those ugly doublespaced copies. They also usually want a list of figures/tables before these sections (capability added in v2.0, control through package options added in v2.2).

I (jdm) am writing a set of styles that look exactly like a journal, but just by adding one style option, I wanted the user to meet the requirements for formatting submissions. I encourage others to do the same.^{1}

∗This file has version number v2.3b, last revised 1995/03/09, documentation dated 1995/03/09.

†Modifications have been made by others over the years. Most extensively by Brian Junker (brian@stat.cmu.edu). Version 2.1 and above include changes by by Jeff Goldberg (J.Goldberg@Cranfield.ac.uk) who is also acting as current maintainer.

1The discussion is section 6.6, by jpg, makes a contrary proposal and recommendation, but jdm, working in old L^{A}TEX209 did not have the distinction between class, package and package

3 Usage

3.1 Loading

Just include the package in your preamble

  \usepackage[...]{endfloat}

Note that versions 2.1 and beyond will no longer work with L^{A}TEX209. Get your administrator to upgrade your site to the new standard, L^{A}TEX 2ε. Although version 2.0 (a L^{A}TEX209 version) will usually work with L^{A}TEX 2ε, it will not do so in combination with certain other packages.

3.2 What it does

Merely loading the package will get it working. Loading it will have L^{A}TEX produce two extra files with .ttt and .fff extensions (for tables and figures, respectively).

This puts all figures and tables at the end of your document and creates a List of Figures and/or List of Tables section at the end (when appropriate and controlable by options). The floats are processed using \baselinestrecth{1} irrespective of what is used in the document as a whole.

It also leaves notes in the text (i.e., “[Figure 4 about here.]”). If you would rather not have these, this can be turned off by using the nomarkers options. If you do not like the look of this marker, you can change their text and appearence (see section 4).

3.3 Starred floats

The figure* and table* versions are supported by the current version.^{2} However, it must be noted that what actually gets processed at the end is without the star. But since the * is harmless in single column mode (which is what you should be doing with for these things at the end), I may make them all stars in a later version. Suggestions are welcome.

3.4 Options

Under version 2.2 (and later I presume), the endfloat package uses package options. The options are summerized in table 1.

The list of tables and figures can be suppressed by using the nofiglist and notablist options. Both can be suppressed with the nolists option.^{3} The default is lists.

A section header for ‘Tables’ and ‘Figures’ can be produced by using the option tabhead, fighead, respectively, and heads for both. These are buggy (see section 7.2). The defaults are notabhead and nofighead.

options available to him at the time he made his comment. Note that in this paragraph he referred to this package as a ‘sytle option’, a term that is only meaningful with the blurred distinctions that existed in earlier versions of L^{A}TEX that he was working with.

2I (jpg) very stupidly introduced a bug in version 2.2 which wrecked figure*. It has been brought to my attention and fixed. I offer my thanks and my apologies.

3In previous versions the command for turning of the lists turned on the headers (the equivalent of the heads option). That is not the case with these options. The lists and the heads options are entirely orthagonal.

Table 1: Options and defaults

Option  Default  Default implication  Descriptions
nofiglist  off  no list of figures
notablist  off  no list of tables

nolists                nofiglist, notablist neither list

figlist  on  list of figures
tablist  on  list of tables
lists                  figlist, tablist  list of tables and figures
nofighead  on  no ‘Figures’ section header
notabhead  on  no ‘Tables’ section header

noheads                nofighead, notabhead neither of the headers

fighead  off  ‘Figures’ section header
tabhead  off  ‘tables’ section header

heads                  fighead, tabhead  Both section headers

markers  on  Place markers in the text
nomarkers  off  no markers in text
tablesfirst  off  Put tables before figures
figuresfirst  on  Put figures before tables

If you want the headers instead of the lists you would need to use both the nolists and the heads options.

If you want to suppress the markers in the text, use the option nomarkers. The default is markers.

Normally the figures at the end appear before the tables. This can be changed by using the option tablesfirst. The default is figuresfirst.^{4}

A typical usage might be something like

\documentclass[a4paper,12pt]{article}
\usepackage[nolists,tablesfirst]{endfloat}
...
\begin{document}

which would suppress the list of tables and figures as well as the corresponding section headers, and would have the tables precede the figures.

3.4.1 Contradictions and dilemmas

It is not recommended that one specify conflicting options, but if you insist, here are the rules. In table 1 the third column indicates what other options are implied by default. That is heads turns on fighead by default, but that implication can be overruled by explicitly stating the nofighead option.

1. When two entirely conflicting options are both specified the one corresponding to the default wins. (e.g., if both markers and nomarkers are specified then markers will be in effect). Here the notion of default is determined by inspecting the second column of table 1.

4It is hoped that future versions will allow new kinds of float or environment to be delayed, in which case an entirely new mechanism will need to be introduced for ordering their appearence.

2. When one option is more specific than the other the more specific one holds true, and the more general will only partially hold. So specifying fighead and noheads will be the same as saying fighead and notabhead. This is the only one of these rules that seems to make sense, so this should be preserved in future versions.

3. The order in which the options appear is not relevant.

4. If some of the obsolete commands for these options are used all bets are off on these interactions.

4 Preparing a foreign language version

\tableplace Announcements in any language can be generated by using \renewcommand to

\figureplace redefine \tableplace and \figureplace

The defaults are

\newcommand{\figureplace}{%
   \begin{center}
     [\figurename~\thepostfig\ about here.]
   \end{center}}
\newcommand{\tableplace}{%
   \begin{center}
      [\tablename~\theposttbl\ about here.]
   \end{center}}

WARNING! The name of the counters posttbl and postfig are very likely to change in future versions, possibly to efloattttctr and efloatfffctr, but whatever they change to, the names will be a function of either the file extension names ttt or fff, or the environment names table and figure. The purpose is so that the counters can be automatically created for new float types.

The name of figures and tables is governed by standard L^{A}TEX variables \figurename and \tablename. The name of the section with the figures can be governed with a

   \renewcommand{\figuresection}{...Name of Figs. section...}

The same can be done for \tablesection.

Hooks for the babel package are not (yet) provided, so you will have to do things by hand:

 \renewcommand{\figurename}{Abra} % if no babel
 \renewcommand{\figureplace}{%
   \begin{center}
     [A(z) \thepostfig.~\figurename itt legyen.]
   \end{center}}

5 Obsolete commands

Versions of the package prior to 2.2 had some commands which the user could specify in the preamble to do what some of the options do now. Those commands will be discontinued. In this version they still function for compatibility, but warning messages are issued recommending the use of the options. The commands are not documented here.

6 Warning!

Please note that section 7 contains a list of more serious problems.

6.1 Extra files

This creates two extra files: ⟨jobname ⟩.fff and ⟨jobname ⟩.ttt. It may also necessitate another L^{A}TEX cycle because of the float movement (when you use \label and \ref) and bibtex.

6.2 Environment names

Because of how the redefinitions of figure and table are actually implemented, it is crucial that these environment names be used. That is, you cannot define a new enviroment which calls figure or table since the former must look for the literal string

 \end{figure}

in the document, while doing no expansion of control sequences. The latter does the same, but wants table instead of figure. This caution generally applies to all ‘verbatim-like’ environments

Steps are slowly being taken to allow for new delayed environments to be added. That will be version 3, but I (jpg) still have a long way to go to get there. Each new minor release of the package includes few changes visable to the user, but may contain substantial internal changes to move the package in the desired direction.

6.3 The Environment’s environment

[This subsection written by jpg]

Because no TEX expansion is done while the material in these floats are read in, but is delayed until the floats are processed at the end of the document, it will be the state of TEX at the end which will matter. For example, a document with something like

  \newcommand{\XXX}{YYY}
  ...
  \begin{table}
  ...
  ... \XXX ...
  ...
  \end{table}
  ...
  \renewcommand{\XXX}{ZZZ}
  ...
  \end{document}

will process the table with \XXX expanding to ZZZ.

Organizing the package so that the floats would be processed by TEX in situ, but stored in boxes which are only output into the .dvi file at the end would solve this problem (and also provide an easy way to solve the problem discussed in section 6.2), but such a move would put a very heavy load on TEX’s memory.

6.4 Ordering End Document material

Version 2.1 uses the L^{A}TEX 2ε directive \AtEndDocument. This makes it L^{A}TEX 2ε specific, but it means that it can be used with other packages that use that directive. Previous versions of endfloat redefined \enddocument. Now several packages or commands can add stuff at the ends of documents and still work together. This does mean that the order of loading packages can be important! If you use several packages that may use the \AtEndDocument directive and you get funny results, try loading them in a different order. It that doesn’t work, complain the the maintainer of the packages so that they will work out a way for the packages to interact correctly. —jpg

6.5 General ordering and wish list

I (jpg) believe that the output of a L^{A}TEX 2ε run should be independent of the order in which package are loaded. It would be possible to set this up, but it would take coordiniation of all package writers who use \AtEndDocument. The actual call to \AtEndDocument would not occur during package loading, but some new command, like \ExecuteAtEndDocument would be called by the user after all such packages are loaded, with tags for each thing in the packages, so something like

   \usepackage{lastpage}
   \usepackage{endfloat,xyzzy}
   \ExecuteAtEndDocument{endfloat,xyzzy,lastpage}

and the order of End Document material would be the endfloat material, followed by xyzzy, and finally by lastpage. The package xyzzy is fictitious, while the package lastpage[1] exists, it doesn’t really matter what these do.

I will have to wait until someone else develops such a system, but I will gladly modify the packages I am responsible for maintaining to comply with it. Until then I will include a message which begins with AED in every usage of \AtEndDocument, and try to minimize any side effects my usage may have.

6.6 What are packages for?

One option is to not have packages like endfloat actually call \AtEndDocument, but merely define a user level command which would make the call itself. This way, the order of those particular commands would matter, but not the ordering of the package loading.

Another advantage of this is that packages could easily be things which make commands available, but do not actually entail a change in .dvi output themselves. It is classes, and options to classes which do that. That is, the actual loading of packages should have no visable effects, other than making new commands available. (Typeface changing packages, such as times, are obvious, and principled, exceptions.) The disadvantage is that it leads to two-step modifications (loading and calling) to change a document.

It is not clear whether this distinction between package and and class (or option) is actually intended with the new document and file structure of L^{A}TEX 2ε. On the one hand, the Class Guide[3] says the following:

The first thing to do when you want to put some new L^{A}TEX commands in a file is to decide whether it should be a document class or a package. The rule of thumb is if the commands could be used with any document class, then make them a package, and if not, make them a class.

For example, the proc document class changes the appearance of the article document class. It is of no use with any other document class, so we have proc.cls rather than proc.sty.

The graphics package, however, provides commands for including images into a L^{A}TEX document. Since these commands can be used with any document class, we have graphics.sty rather than graphics.cls.

Without stating it explicitly, this appears to presuppose that packages will provide new commands, and classes (or options to them) will change output by virtue of their being called. On the otherhand, in the Companion[2], the authors seem happy to describe packages (including endfloat itself) which do change document behavior.

I believe that the restriction that packages should not, by virtue of being loaded, change output is nice but too restrictive. Without going into detail why I believe so, it is enough to point out that imposing such a restriction would make the semantics of package loading more uniform, but would place the burden on the user to not only load, but to invoke the package (either through specifying class options or by a command), making the user responsible for remembering which packages are of the ‘need to be invoked’ sort. So, it seems that we may have a little paradox where the more uniform semantics leads to a less transparent user interface.

As a compromise, I would propose any package (other than typeface changing packages) which changes output instead of merely providing additional commands, should be clearly labelled as doing such in the documentation and in a message.

7 Bugs

7.1 Float position specifiers

Still needs to gobble float position specifiers. Bug noted March 14, 1992.

As of October 1994, this bug remains. It means that the float specifiers are written to the .fff and .ttt files and will be in effect when those are run. That wouldn’t really be a problem, except that [p] specifier can lead to funny results if the heads option is used, because a float page can be created for the first float, leaving the header on a page by itself. I (jpg) have ideas about fixing it, but having had the time is another question.

7.2 Misplaced headers

Version 2.2c contains a partial fix to a problem with the placement of floats around the section headers produced by the heads option. There were two varients of the problem. In one the first float after the header would float above the header. This has been fixed by using the L^{A}TEX 2ε command \suppressfloats. The other problem is that that the first float may float to a page float after the page with the header on it.

This has been partially fixed, but if users use the [p] specification on their floats or if there are large floats, the problem can still show up. It is recommended that whenever the user wants a [p] that an [hp] be used instead. In normal running (without endfloat), this should only rarely effect the document, but it will help avoid the problem with the floating end float. An [h] may also be needed for large floats. There is only need to be concerned about the first figure and first table.

The natural solution to this problem will require that the bug in described in section 7.1 be resolved.

8 History

8.1 The burden of history

By version 2.2 the file was getting so that most of the bytes were things that had been commented out of previous versions, and changelog messages. Instead of this making things clearer to the maintainer, it turns out to be clutter. I (jpg) have started to throw out some of history (it is not really useful to see who corrected what typo or cleaned up what extraneous space with a % in 1991. Although my purge of history is far from complete, it should be noted that I do want to preserve the spirit of the history. I have already been miscredited with authorship, and wish to make it clear that not only am I (jpg) not the author, I don’t fully understand all of the TEX work here.

8.2 Author

The file was written by Darrell McCauley (jdm5548@diamond.tamu.edu) in February and March 1992. He acknowledges that much of the guts are adapted from comment.sty by Victor Eijkhout (eijkhout@csrd.uiuc.edu). So, although Jeff Goldberg^{5} (J.Goldberg@Cranfield.ac.uk) now maintains this, he should not be credited with writing the package.

8.3 Version 2.3

Very minor changes in the organization of some parts of the code, but I fixed a bug I introduced while “cleaning up” for for version 2.2: I had misunderstood part of the original code and commented out a necessary trick to allow for figure* The bug was very real, so I am releasing this version as soon as I can document it, and am not waiting to include other planned improvements.

8.4 Version 2.2

A user (Kate Hedstrom) pointed out a number of bugs and shortcomings, which led me (jpg) to finally sit down and make some of the changes I had been planing on making. The effect of the tablesfirst option was specifically requested, and also work on the bug dicussed in section 7.2. Although my bug fix is partial, version 2.2 includes the means to suppress the headers althogether.

5http://www.cranfield.ac.uk/public/cc/cc047/

8.4.1 Package options

I, jpg, have used the package option facility of L^{A}TEX 2ε to get other options (descibed in section 3.4). I also made some cosmetic changes (breaking up lines to reduce the number of overfull boxes when printing the documentation, line breaks and indentation to make the code more readable. I also replaced some \defs with \newcommands and \providecommands. This are not logged, because I actually found that all of the logging information was hampering my ablity to read and modify the code.

8.4.2 Internal commands

In version 2.2, I also replaced some code internal to \xfigure and \xtable with

\efloat@foundendfig and \efloat@foundendtab. This was merely a stylistic

change.

I also deleted some some definitions which are not used. These had had probably been left as hooks, but with not enough for them to be useful hooks. There are some cases where I have left these in when I could see what they could be used for. I have tried to add a note as to their potential use.

8.4.3 Documentation

Massive changes to user documentation, and some to the code documentation.

8.5 Version 2.1

I, Jeffrey Goldberg, in June 1994 wanted to use Darrell McCauley’s endfloat.sty with L^{A}TEX 2ε. It worked fine until I needed to use the L^{A}TEX 2ε directive \AtEndDocument for some other function, and discovered that it was not functioning and that it was because version 2.0 (and earlier) of endnotes.sty redefined \enddocument. The fix that I needed was trival, but it made the file no longer compatible with L^{A}TEX209. As a consequence, it seemed that the only way I could make up for this crime was to make it fully compatible with L^{A}TEX 2ε.

8.6 Minor changes

A series of changes and fixes were made in March 1992. Many by the original author others by Ronald Kappert (R.Kappert@urc.kun.nl) who replaced literal strings with \figurename, and so on; and by schultz@unixg.ubc.ca who pointed out gobbling bug with \nomarkersintext.

8.7 Brian Junker’s modifications

Brian Junker (brian@stat.cmu.edu) made a number of fixes. Here are his change comments:

1. Changed “comment” to “figure” and “komment” to “table” throughout, to avoid collisions with other style files’ definitions of “comment”. Also fixes \begin{table} ends with \end{komment} error generated by my (older) version of PCTEX.

2. Fixed gobble of float position specifiers. There are two ways to do this:

 (a) \write\ifnextchar[{\gobbleuntilnext}{} into every environment

written to \jobname.fff, etc.;

(b) save L^{A}TEX’s old def’s of \figure and \table and re-use them when processing fig’s and tables. I chose the latter approach, for maximum consistency with L^{A}TEX, other style files, etc.

3. Added def’s of \tablename and \figurename, which my version of PC-TEX seemed to need. [backward compatability for earlier versions —jdm]

4. Moved formatting of figure and table markers to \figureplace and

\tableplace.

5. Style change: in-text markers are now centered reminders like “[Figure 4 about here.]”.

6. Style change: added list of tables and figures to the table and figure sections. Change back to old format with \nofiglist and \notablist.

7. Changed default to \markersintext.

8. Fixed trivial typo in \@openposttbls

All changes marked % bj at end of line. —Brian Junker (brian@stat.cmu.edu)

9 Wish list

I doubt that I will really work on this wish list in the near future but in addition to solving the know bugs, there are two major sorts of changes that I (jpg) would like to see.

1. Updating the verbatim writing by using the tools in the verbatim standard packages, and the moreverb package. Since they provide more generalized an cleaner verbatim code then this which dates back to the earliest days of L^{A}TEX.

2. Integrate with the float package which (among other things) enables the user to define new floating environments. endfloat v2.2 only allows figures and tables to be placed at the end, not all types of potential floats. Nor does it allow the user to specify which of the two types it does recognize to be placed at the end.

References

[1] Jeffrey Goldberg. The lastpage package. electronic documentation

[2] Michel Goossens, Frank Mittelbach, and Alexander Samarin. The L^{A}TEX Companion. Addison-Wesley, Reading, Massachusetts, 1994.

[3] The L^{A}TEX3 Project. L^{A}TEX 2ε for class and package writers (Preliminary draft) June 1994. Electronic Documentation

Index

The italic numbers denote the pages where the corresponding entry is described, numbers underlined point to the definition, all others indicate the places where it is used.

figureplace=  \subitem *+\figureplace+, \usage{4}

                          tableplace=  \subitem *+\tableplace+, \usage{4}