The endfloat package^{∗}

James Darrell McCauley  Jeff Goldberg^{†}

1995/10/11

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. Markers, like “[Figure 3 about here]” appear in the text (by default) near where the figure (or table) would normally have occurred. This is usually required when preparing submissions to journals.

A number of package options and other mechanisms are provided to give the user control over various aspects of the package’s behavior.

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

Contents

1 In many voices 1

2 Why write this package? 2

3 Usage 2 3.1 Loading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 3.2 What it does . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 3.3 Starred floats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 3.4 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3.4.1 Contradictions and dilemmas . . . . . . . . . . . . . . . . . 4

4 Modifying marker text 4

5 Commands before processing delayed material 5

6 Processing delayed floats before the end 5

7 Several floats per page 5 8 Configuration file and other end environments 6

∗This file has version number v2.4i, last revised 1995/10/11, documentation dated 1995/10/11.

†JPG (J.Goldberg@Cranfield.ac.uk) is responsible for all modifications from version 2.1 upwards. Since there is almost no original code left, he has claimed co-authorship from version 2.4. He is also the current maintainer.

8.1 Modified figures and tables . . . . . . . . . . . . . . . . . . . . . . 6 8.2 Sideways figures and tables . . . . . . . . . . . . . . . . . . . . . . 6 8.3 Changing list and caption appearance . . . . . . . . . . . . . . . . 7

8.3.1 Removing captions . . . . . . . . . . . . . . . . . . . . . . . 7 8.3.2 Eliminating numbers from lists of tables and figures …. 7

9 Obsolete commands 8

10 Caveats 8 10.1 Literal strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 10.2 Extra files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 10.3 Environment names . . . . . . . . . . . . . . . . . . . . . . . . . . 9 10.4 The Environment’s environment . . . . . . . . . . . . . . . . . . . 9 10.5 Verbatim in delayed floats . . . . . . . . . . . . . . . . . . . . . . . 10 10.6 Ordering End Document material . . . . . . . . . . . . . . . . . . . 10

10.6.1 General ordering and wish list . . . . . . . . . . . . . . . . 10 10.7 What are packages for? . . . . . . . . . . . . . . . . . . . . . . . . 10 10.8 Float position specifiers . . . . . . . . . . . . . . . . . . . . . . . . 11 10.9 Misplaced headers . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 10.10Known incompatibilities . . . . . . . . . . . . . . . . . . . . . . . . 11

10.10.1 Environment names . . . . . . . . . . . . . . . . . . . . . . 11 10.10.2 Ordering end material . . . . . . . . . . . . . . . . . . . . . 12 10.10.3 Conflicting \enddocument . . . . . . . . . . . . . . . . . . . 12 10.10.4 Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . . 12

11 Support 12

12 History 12 12.1 The burden of history . . . . . . . . . . . . . . . . . . . . . . . . . 12 12.2 Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 12.3 Version 2.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 12.4 Version 2.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 12.5 Version 2.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

12.5.1 Package options . . . . . . . . . . . . . . . . . . . . . . . . . 14 12.5.2 Internal commands . . . . . . . . . . . . . . . . . . . . . . . 14 12.5.3 Documentation . . . . . . . . . . . . . . . . . . . . . . . . . 14

12.6 Version 2.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 12.7 Minor changes (version 2.0) . . . . . . . . . . . . . . . . . . . . . . 15 12.8 Brian Junker’s modifications (version 2.0) . . . . . . . . . . . . . . 15

13 Wish list 15

14 The documentation driver file 16

15 The implementation 16 15.1 File and package identification . . . . . . . . . . . . . . . . . . . . 16 15.2 How it was written . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 15.3 Define warning message . . . . . . . . . . . . . . . . . . . . . . . . 17 15.4 Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

15.4.1 Default values . . . . . . . . . . . . . . . . . . . . . . . . . . 17 15.5 Other preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 15.6 Parsing figure and table . . . . . . . . . . . . . . . . . . . . . . . 20 15.7 Processing Figures and Tables . . . . . . . . . . . . . . . . . . . . . 22

15.7.1 Getting float placement correct . . . . . . . . . . . . . . . . 23 15.7.2 Calling the processing commands . . . . . . . . . . . . . . . 24

16 Extra macros – HIGHLY Experimental 24 16.1 Getting new delayed environments . . . . . . . . . . . . . . . . . . 24

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 12 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.

This documentation is long. Most users won’t need to read beyond the first few pages, but there are a number of ways to customize the behavior of endfloat and these are detailed as the documentation progresses. The package is unusual in the way it does its job, so it can interact with other packages and other aspects of L^{A}TEX in ways that may be surprising. Although the package is flexible in some respects, it is highly limited in others. Tools and hints are provided to help you control these interactions, but these do require some reading. But you only need to take a look at these sections when the need arises.

2 Why write this package?

Many journals require tables and figures to be separated from the text when you submit those ugly double spaced 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}

1Note that jdm, working in old L^{A}TEX209 did not have the distinction between class, package and package options available to him at the time he made his comment. The most coherent way to do what is needed is to use a class, let’s say submit, which would load endfloat and presumably some double spacing packages among other things. Once that class is defined, then other classes which are specific to particular journals can be defined.

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 each on a page by itself^{2} and creates a List of Figures and/or List of Tables section at the end (when appropriate and controllable by options). The floats are processed using \baselinestretch{1} irrespective of what is used in the document as a whole. This can be reset to, say 1.4, by using

 \AtBeginDelayedFloats{\renewcommand{\baselinestretch}{1.4}}

which is available from version 2.4. See section 5 for more discussion.

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 appearance (see section 4).

3.3 Starred floats

The figure* and table* versions are supported by the current version.^{3} However, it must be noted that what actually gets processed at the end is always with the star, since in single column mode the * is harmless.

3.4 Options

Under version 2.2 and higher, the endfloat package uses package options. The options are summarized in table 1. In addition to these options, see sections 8 and 5 for more advanced ways of controlling output.

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

2This is the default. See section 7 to see how to have multiple floats per page.

3I (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.

4In versions prior to 2.2 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 orthogonal.

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

A section header for ‘Tables’ and ‘Figures’ can be produced by using the option tabhead, fighead, respectively, and heads for both. The defaults are notabhead

and nofighead.

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.^{5}

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.

5It 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 appearance.

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.

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 Modifying marker text

\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}}

These redefinitions may be placed in the endfloat.cfg file (see section 8 for more information).

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.

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}}

If you wish to change the name of the figure or table section heading, you can to that in the usual way (via the babel package, or by redefining \figuresection and tablesection directly).

5 Commands before processing delayed material

\AtBeginFigures If you wish to have some more control over how the tables and figures are processed,

\AtBeginTables
\AtBeginDelayedFloats

you can make use of the commands \AtBeginDelayedFloats, \AtBeginFigures

and \AtBeginTables. If you wanted to ensure that the tables begin on a recto page, you could for example say something like \AtBeginTables{\cleardoublepage} in the preamble of your document.^{6} Material in \AtBeginTables and \AtBeginFigures is processed after the list of tables or list of figures (if those options are set) and just before the files with the delayed material in input. These are also processed after the original definitions of the table and figure environments are restored.

These commands can be used either in the preamble of your document, or in the endfloat.cfg file (see section 8).

6 Processing delayed floats before the end

\processdelayedfloats If you wish to process the floats prior to the end of the document, you may do so with the \processdelayedfloats command, which has been made available from version 2.4 onward. This will process all of the unprocessed tables and figures up to that point. You may wish to use this command at the end of every chapter for example.

If you do use this, there are several points which should be noted.

1. All outstanding floats will be processed at the end of the document.

2. If you use the lists option you will get a list of all tables and figures in the document. Not just the ones for the current chapter. Using lists may have other odd consequences.

3. It is your responsibility to set \tableplace and \figureplace correctly, as well as to possibly reset the counters \theposttbl and \thepostfig (section 4) as you wish. If you do not reset them, they will continue to increase throughout the document.

7 Several floats per page

\efloatseparator Endfloat places \efloatseparator after each float in their respective files. By default it is defined to be \clearpage forcing one float per page. You may change this by using \renewcommand to redefine \efloatseparator as you wish. One possibility, suggested by a user, is

 \renewcommand{\efloatseparator}{\mbox{}}

It makes most sense to place such a redefinition in the configuration file (see section 8).

Do not be mislead by my misleading name for this command. This actually appears after each float including the last one, so is not truly a separator.

8 Configuration file and other end environments

Many users have suggested options to the package which are often journal specific. Many of the suggestion options are also not specific to how endfloat itself works, but to how captions and lists of figures and tables are to appear. Instead of burdening the package with options that, in the end, are specific to particular journals, I have added a configuration file for endfloat which will allow you to make many of these redefinitions without having to further increase the size of endfloat itself.

6It is difficult for me to imagine a situation where one would be using endfloat and the class option twoside, without which \cleardoublepage is the same as \clearpage, together. Another, more realistic example would be to adjust the \baselinestretch for table and figure processing.

As of version 2.4 endfloat will look for a file called endfloat.cfg in TEX’s input path. If it is found, it will be included after endfloat is loaded. The purpose of this configuration file is to allow the user to include additional definitions related to endfloat. For example, any redefinition of \figureplace can go in this file, so that the preamble does not need to be filled with material that only makes sense when endfloat is loaded.^{7}

The configuration file can also provided so that the user could specify environments other than figure and table (and their *-ed counterparts) which can be delayed until the end of the document. At the moment that would be very difficult to do with environments which are not processed with tables of figures (ie, those environments that should have a different “list-of”, different counters, and different temporary files from those used by tables and figures); but the plan is to make even that ever more easier.

8.1 Modified figures and tables

As stated in section 10.3, endfloat will utterly fail if one does something like

\newenvironment{foo}{...\begin{table}...}
    {...\end{table}...}

because endfloat will make \begin{table} go into a verbatim like mode and look for the literal string \end{table}, which it will not see in \end{foo}.

However, for those who know L^{A}TEX internals fairly well, it is not impossible to tell endfloat to also treat the foo environment as a delayed table. It is however, not easy, although my goal is to make this easier in subsequent versions. It will take a fair amount of understanding of the implementation to see how to do this. And the best thing to do is to follow an example.

8.2 Sideways figures and tables

The rotating package[5] contains definitions of environments sidewaysfigure and sidewaystable,^{8} and it would be nice to have these work in documents which also use endfloat. Appropriate redefinitions of these so that they work with endfloat are given in the file efxmpl.cfg. If you wish to use that file, you should include it as a package (possibly renamed) after you include endfloat. Or you could simple rename it to endfloat.cfg and endfloat will include it automatically.

For a description of those commands see section 16.

7However, if you find yourself placing other material (such as double spacing or modification of title page and abstract) into endfloat.cfg to simulate a journal submission class, you should really do the right thing and create a journal submission class. Creating a minor class (one that loads an existing class such as article is not difficult. See the Class Guide[3] for instructions.

Future versions of the endfloat documentation may include a sample.

8These require support from the dvi driver, such as dvips.

8.3 Changing the appearence of “lists of” and captions

When the lists option is used, the L^{A}TEX commands \listoftables and \listoffigures are called. These produce lists indicating the page number that each table or figure appear on. With endfloat in use this information is usually superfluous, and – rumor has it – undesirable by at least some journals. What seems to be required when using lists is that either the list does not the figure or table number, and/or the caption doesn’t not contain the caption text.

This section provides a few rudimentary samples of what you might put into the configuration file to get these effects. I have chosen not to make these package options, because they are often too journal specific. The availability of the configuration file means that you can put this things there, and the differences between endfloat using and non-endfloat using L^{A}TEX source documents is minimal.

8.3.1 Removing captions

\@makecaption The simplest thing is to provide a simple redefinition of \@makecaption. You should model your redefinition after the one described in classes.dtx for your release of L^{A}TEX instead of blindly following what is here. \@makecaption takes two arguments, the first will be something like “figure 3” and the second will be the caption text. We will simply ignore the second argument. Most of the tricky bit of the definition is about testing whether the caption is longer than a line. Since we will only be using the first argument, we can safely assume that the caption will fit on one line.^{9} Your redefinition of \@makecaption may look like

\renewcommand{\@makecaption}[2]{%
  \vskip\abovecaptionskip
  \hbox to \hsize{\hfil #1\hfil}%
  \vskip\belowcaptionskip}

\caption This still leaves one problem. If you use

     \caption[short caption text]{full caption text }

only the short caption text will ever appear in the list of tables or figures. The following redefinition of \caption will take care of that. First save the original definition of \caption

 \let\OrigCaption\caption
 \renewcommand{\caption}[2][X]{\OrigCaption[#2]{}}

8.3.2 Eliminating numbers from lists of tables and figures

This is a bit trickier, and I have heard that it doesn’t work with all versions of L^{A}TEX 2ε, but I am unwilling to reinstall and older version for debugging this. A user [get the name] suggested that page numbers be suppressed in the lists of figures and tables.

\l@figure \l@table All this requires is a redefinition of \l@figure and \l@table which are defined in classes.txt. Also see section 2.4.1 of the Companion to see how these macros are called.

9If you have \figurename as something absurdly long or a very narrow \textwidth, then you will have to use a more complicated version.

The real only trick here is that \l@figure is defined to take two arguments, but the second is never used. The way it will be called will give it something like

 {\numberline {3} Caption of that figure}{85}

as arguments, where the second argument is the page number. The \numberline command will make use of the L^{A}TEX register \@tempdima for the width of the box containing the table or figure number. So we need to set that. The rest is pretty unsophisticated. You can, of course, modify it at will.

\renewcommand*{\l@figure}[2]{%
   \setlength\@tempdima{2.3em}%
   \noindent\hspace*{1.5em}#1\hfil\newline }

And for tables:

\let\l@table\l@figure

9 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. Although I would like to eventually remove those commands, they are documented in the Companion; so they will remain for quite some time.

10 Caveats

Some of the things that are listed here may be considered bugs, design errors, interactions to watch out for, or just the way life is sometimes. They are, at least, a matter of concern, and you should watch out for them.

10.1 Literal strings

When floats are being read, L^{A}TEX is in verbatim mode. Among other things, this means that the lines like

\end{figure}

must appear on lines by themselves without any whitespace before or after them. A complete reimplementation of the most difficult part of the package is required to fix this limitation, but it is among the distant goals I have.

10.2 Extra files

This creates two extra files: ⟨jobname ⟩.fff and ⟨jobname ⟩.ttt. Any files by those names in the current directory will be overwritten.

10.3 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 simply define a new environment 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

Although I haven’t been able to confirm this yet, the L^{A}TEX system ScientificWord^{10} may automatically put floats inside a macro called \FFRAME. If so, I hope that either someone from ScientificWord or one of its users will create something for \FFRAME similarly to what I have done for \sidewaystable in the sample configuration file (section 8).

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 visible to the user, but may contain substantial internal changes to move the package in the desired direction. Version 2.4 now contains a configuration file in which various things can be defined. See section 8 for more information.

Once it does become easier to delay other environments, the word “float” may not be the best expression, since there will be no reason to expect that only floating environments are delayed.

10.4 The Environment’s environment

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.

In any particular instance, the user can use either re-redefine \XXX before the end of document, or can re-redefine it using on of the hooks, \AtBeginDelayedFloats, \AtBeginTables, or \AtBeginFigures, which are discussed in section 5.

10A registered trademark. Write to info@tcisoft.com for more information.

10.5 Verbatim in delayed floats

There should be no problem with verbatim text within a float unless that verbatim text contains an \end{figure} or \end{table} in a figure or table respectively. I don’t see a fix for this. All I can imagine is that you create a new delayed type which behaves exactly like figure (or table) (even writing \begin{figure} and \end{figure} to the .fff file. [mutatis mutandis for table]) In future versions, I may create a sample like this in the sample configuration file, but it is a low priority since the only time one would write such a figure or table would be in a document about L^{A}TEX and it is difficult to imagine circumstances where a document about L^{A}TEX would need to be subject to endfloat.

10.6 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 to the maintainer of the packages so that they will work out a way for the packages to interact correctly.

10.6.1 General ordering and wish list

I 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 coordination 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.

10.7 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 visible 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.

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

10.8 Float position specifiers

Float position specifiers are passed to the temporary files and are used when those floats are processed. This may lead to funny results, especially if the first figure or first table uses [p] while the heads option is being used. This can lead to that float, floating to the page after the header. Most other float specifiers will not lead to any problems, because the package mucks about the various float specification parameters.

10.9 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 variants 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 first 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 10.8 be resolved.

10.10 Known incompatibilities

Above I have outlined sources of potential conflicts and incompatibilities with other packages. Those sections contain a discussion of potential work-arounds. Here I list where I know of specific incompatibilities with distributed packages. This list is not complete. If you know on an addition, please let me know.

10.10.1 Environment names

The packages listed here all have the problem described in section 10.3. The work-arounds are also described there. rotating, Scientific Word.

10.10.2 Ordering end material

The following packages put things at the end of the document, and peculiar results are possible if you don’t pay attention to the order in which packages are loaded. This is described in section 10.6.1. The package lastpage is among these, as are recent versions of the package harvard.

10.10.3 Conflicting \enddocument

Prior to L^{A}TEX 2ε’s provision of the hook \AtEndDocument, package writers were forced to redefine \enddocument. Some did so in ways that over wrote any other package’s redefinition of the same. When you encounter such a package you should try to get its author to release a modified version. Version 2.0 of endfloat was such a packages. So was the winter 1993 version of harvard (which has been fixed). But for those using an old version of harvard you will encounter problems.

10.10.4 Miscellaneous

There are several other potential conflicts that don’t fall into the broader categories.

• \listoftables and \listoffigurers are left undefined in class elsart. But this is because Elsevier does not want those lists. Elsevier, bless them, does not want floats at the end for submissions to its journals. So there is no reason to use endfloat (with or without lists) with class elsart. Let’s hope that other publishers will follow Elsevier’s lead in understanding that the submission rules which were created were created for a reason, and when those reasons no longer apply, the rules should be changed.

I look forward to the day when endfloat will serve no purpose.

• The float package appears to work in my limited tests. Although, only tables and figures get moved to end. The success is due to the robustness with which float is written.

11 Support

As is usual, this package is provided with no warranty whatsoever. However, it is my desire to make it useful and usable, although I may very well fail at that. If you need a feature added, see whether the hooks will allow you to do what you want. If something goes wrong look over section 10. But if you need to get in touch with the maintainer, you should send email to me at J.Goldberg@Cranfield.ac.uk.

12 History

12.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 original authorship. I have made extensive modifications and extensions, but the basic core (even if only a small amount of version 2.0 code remains) and concept are JDM’s.

12.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 (J.Goldberg@Cranfield.ac.uk) now maintains this, he should not be credited with writing the package, but only with extending and maintaining it. He has contributed enough so that by version 2.4 he claimed co-authorship.

12.3 Version 2.4

Version 2.4 involves the largest set of additional features since at least version 2.2 (which added all the options). Some of these are

• This version adds various user hooks, both as commands: \AtBeginFigures,

     \AtBeginTables, and \AtBeginDelayedFloats (section 5), and \efloatseparator

(section 7).

• Most importantly, there is the addition of a configuration file (section 8). An example configuration file contains code which allows endfloat to work properly with the sidewaystable environment of the rotating package.

• Additionally, all figures and tables are written as figure* and table* in the temporary files, eliminating the need to force single column mode when table and figures are processed.

• There are a fair number of internal changes to the code (which make it easier for the various hooks to work).

• Also changed some internal command names, such as \xtable, which did not include @ to names that to include @ such as \ef@extable. Also renamed all commands \end... to something else so as to not use up valuable environment name space.

• Removed dead code. It was making this too hard to read.

• Documentation changes to reflect user level changes. Also added more to the Caveats section (section 10).

During the past few months I have received a wonderful level of feedback from users. Many made very useful suggestions. Even those queries which resulted from a misunderstanding of how to use the package have been lead me to modify the documentation. I had intended to acknowledge all of you, but the list has grown too long. You know who you are. Thanks, and good luck with your journal submissions!

12.4 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 2.3 as soon as I can document it, and am not waiting to include other planned improvements.

12.5 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 planning on making. The effect of the tablesfirst option was specifically requested, and also work on the bug discussed in section 10.9. Although my bug fix is partial, version 2.2 includes the means to suppress the headers altogether.

12.5.1 Package options

I, jpg, have used the package option facility of L^{A}TEX 2ε to get other options (described 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 ability to read and modify the code.

12.5.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.

12.5.3 Documentation

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

12.6 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 trivial, 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ε.

12.7 Minor changes (version 2.0)

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.

12.8 Brian Junker’s modifications (version 2.0)

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 compatibility 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)

13 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

[4] Anselm Lingnau. An Improved Environment for Floats June 1994 (version 1.2) Electronic Documentation

[5] Sebastian Rahtz and Leonor Barroca. A style option for rotated objects in L^{A}TEX April 1994. (version 2) Electronic Documentation

14 The documentation driver file

The next bit of code contains the documentation driver file for TEX, i.e., the file that will produce the documentation you are currently reading. It will be extracted from this file by the docstrip program.

1 ⟨∗driver⟩

 2 \documentclass{ltxdoc}
 3 \setlength\hfuzz{2pt}    % ignore small overfulls
 4 \CodelineIndex
 5 \EnableCrossrefs
 6 %\DisableCrossrefs   % Say \DisableCrossrefs if index is ready
 7 %\RecordChanges      % Gather update information
 8 %\OnlyDescription    % comment out for implementation details
 9 \begin{document}
10 \DocInput{endfloat.dtx}
11 \end{document}

12 ⟨/driver⟩

15 The implementation

15.1 File and package identification

We start by checking if this file was already loaded. If not we identify the current version.

13 ⟨∗package⟩

14 \NeedsTeXFormat{LaTeX2e}[1994/06/01]
15 \ProvidesPackage{endfloat}[\filedate\space\fileversion\space
16  LaTeX2e package puts figures and tables at end (jdm)]

15.2 How it was written

[this subsection mostly based on jdm’s original text.]

Overview: redefine the figure and table environment following the comment environment of comment.sty written by Victor Eijkhout eijkhout@csrd.uiuc.edu.

Instead of processing what was between \begin{...} and \end{...}, every line is written to a file (\jobname.fff for figures, \jobname.ttt for tables). Then, when you do an \end{document}, the figure section is processed, then the table section is processed. The tablesfirst option changes this order.

After initial versions, I [jdm] received much help from Ronald Kappert and Brian Junker (see change log below). Thanks guys!

15.3 Define warning message

Since I, JPG, am making the commands options, I want to warn users to use the options, since these commands should be discontinued in future versions.

17 \newcommand{\ef@OldCmd}[2]{\PackageWarning{endfloat}
18 {The command \protect#1 is obsolete and will be\MessageBreak
19 omitted from future releases of the endfloat package.\MessageBreak
20 Use the package option `#2' instead.}}

15.4 Flags

Put all of the newifs for the user options and flags here.

21 \newif\if@domarkers
22 \newif\if@tablist                % bj
23 \newif\if@figlist                % bj
24 \newif\if@tabhead
25 \newif\if@fighead
26 \newif\if@tablesfirst

15.4.1 Default values

Set default values of all of the flags here.

27 \@domarkerstrue
28 \@tablisttrue
29 \@figlisttrue
30 \@tabheadfalse
31 \@figheadfalse
32 \@tablesfirstfalse

\markersintext \nomarkersintext First set up flags and defaults. First set for flagging whether markers appear in text.

33 \DeclareOption{nomarkers}{\@domarkersfalse }
34 \DeclareOption{markers}{\@domarkerstrue }
35 \newcommand{\markersintext}{\@domarkerstrue
36 \ef@OldCmd{\markersintext}{markers}}
37 \newcommand{\nomarkersintext}{\@domarkersfalse
38 \ef@OldCmd{\nomarkersintext}{nomarkers}}

\dotablist \notablist Options for creating lists of Tables …

39 \newcommand{\dotablist}{\@tablisttrue \ef@OldCmd{\dotablist}{tablist}}
40 \newcommand{\notablist}{\@tablistfalse \@tabheadtrue
41 \ef@OldCmd{\notablist}{notablist}}
\dofiglist \nofiglist . . . and Figures
42 \newcommand{\dofiglist}{\@figlisttrue \ef@OldCmd{\dofiglist}{figlist}}
43 \newcommand{\nofiglist}{\@figlistfalse \@figheadtrue
44 \ef@OldCmd{\nofiglist}{nofiglist}}
   Now we make options tablist and notablist and figlist and nofiglist.

Note that options will be processed in order of the \DeclareOption commands in this file. So by placing list after nolist we ensure that if both are specified, list is in effect.

First two new options

45 \DeclareOption{nolists}{\@tablistfalse \@figlistfalse }
46 \DeclareOption{lists}{\@tablisttrue \@figlisttrue }

Now the more specific ones, which must come after the more general options to get the right interactions between semi-conflicting options.

47 \DeclareOption{notablist}{\@tablistfalse }
48 \DeclareOption{nofiglist}{\@figlistfalse }
49 \DeclareOption{tablist}{\@tablisttrue }
50 \DeclareOption{figlist}{\@figlisttrue }

The notablist and nofiglist options still leave a section header at the beginning of the tables and figures.

Note again the role that order plays, by placing fighead after noheads it ensures that fighead will be in effect if both are specified.

51 \DeclareOption{heads}{\@figheadtrue \@tabheadtrue }
52 \DeclareOption{noheads}{\@figheadfalse \@tabheadfalse }
53 \DeclareOption{fighead}{\@figheadtrue }
54 \DeclareOption{tabhead}{\@tabheadtrue }
55 \DeclareOption{nofighead}{\@figheadfalse }
56 \DeclareOption{notabhead}{\@tabheadfalse }

Also need option for putting tables first

57 \DeclareOption{tablesfirst}{\@tablesfirsttrue }
58 \DeclareOption{figuresfirst}{\@tablesfirstfalse }

Other option stuff

59 \DeclareOption*{%
60 \PackageWarning{endfloat}{Unknown option `\CurrentOption'}}
61 \ProcessOptions

15.5 Other preliminaries

I (jpg) have been slowly working at making more and more of the code for processing tables and figures common, with the idea that once I have factored out all that is common with them I will be then be able to set up code for other floats, I have still a very long way to go, but common code created for version 2.3 is here.

\efloat@openpost \efloat@newwrite attempt to reduce old \@openpostfigs and \@openposttbls to one command

The first one calls \newwrite so, \efloat@newwrite{ttt} will have the effect of

\newwrite\efloat@postttt.
62 \def\efloat@newwrite#1{%
63 \expandafter\newwrite\csname efloat@post#1\endcsname}
\efloat@openpost{ttt} will be the same as
   \immediate\openout\efloat@postttt=\jobname.ttt\relax

while also calling \ef@setct{ttt}{1} to set a flag (@ef@tttopen) in the case of

ttt.
64 \def\efloat@openpost#1{\expandafter\immediate\expandafter\openout
65  \csname efloat@post#1\endcsname =\jobname.#1\relax
66 \ef@setct{#1}{1}
67 \message{(\jobname.#1)}}
\ef@setct \ef@newct  \ef@newct{ttt} will create a new counter called \@ef@tttopen and \ef@setct{ttt}{1}

would set it to 1.

68 \def\ef@newct#1{%
69 \expandafter \newcount \csname @ef@#1open\endcsname}
70 \def\ef@setct#1#2{\expandafter\global\csname @ef@#1open\endcsname=#2\relax}

Conditionally open a file

71 \def\efloat@condopen#1{%
72  \expandafter\ifnum \csname @ef@#1open\endcsname>0 \relax \else
73  \efloat@openpost{#1}\fi}

Immediate write to one of these files.

74 \def\efloat@iwrite#1#2{%
75 \expandafter\immediate\expandafter\write\csname efloat@post#1\endcsname
76  {#2}}

\efloatseparator A user suggested that in some cases we may not wish to force endfloat to put each float on a page by itself. By default that is what it does, by defining \efloatseparator to be \clearpage. If you want it to be something else, you may redefine this command in the configuration file or preamble.

77 \newcommand{\efloatseparator}{\clearpage}
\postfig Counters
78 \newcounter{postfig}

Code for opening the \jobname.fff

79 \efloat@newwrite{fff}
80 \ef@newct{fff}

\posttbl Same stuff but for tables

81 \newcounter{posttbl}

Commands for opening \jobname.ttt This sets up new write for tables

82 \efloat@newwrite{ttt}
83 \ef@newct{ttt}

\ef@makeinnocent
84 \newcommand*{\ef@makeinnocent}[1]{\catcode`#1=12 }
\figureplace \tableplace Place markers.
\figurename \tablename Make sure that \tablename and \figurename are defined.
85 \providecommand{\figurename}{Figure}
86 \providecommand{\tablename}{Table}
87 \newcommand{\figureplace}{%
88 \begin{center}
89  [\figurename~\thepostfig\ about here.]
90 \end{center}}
91 \newcommand{\tableplace}{%
92 \begin{center}
93  [\tablename~\theposttbl\ about here.]
94 \end{center}}

15.6 Parsing figure and table

Now we get the utilities for parsing needed to get unmodified code into files.

95 %\def\@gobbleuntilnext[#1]{}  % Not used (jpg)
96 \let\@bfig\figure             % bj
97 \let\@btab\table              % bj
98 \let\efloat@float\relax

\figure the blank space appearing with \nomarkersintext was fixed by adding a percent sign (%) at strategic locations, determined by setting \tracingcommands=1 — Darrell

As mentioned by the jdm above, the following is based on comment.sty. It appears that the idea is to turn off all control sequence processing and read in from input each line, until a line is found that looks like \end{figure}. Thus the actual name of the environment is hardcoded into the use of the macros (see section 10.3). —jpg]

99 \def\figure{%

If we have already done one table then the file we write to is already open, and there is nothing to do, else open it up.

100  \efloat@condopen{fff}

We have read a \begin{figure} to get here. We need to write that into the file.

I (jpg) would add the [htb] parameters to what gets written, but that leaves any float specifiers that had been employed by the user wandering around in the floated material.

101  \efloat@iwrite{fff}{\string\begin{figure*}}%

Since the figures are not actually processed until much later, we don’t use L^{A}TEX’s figure numbering mechanism, but we use our own. Also put marker in text (if option set). In the future, I may combine the counter for the markers and the counter used as a flag for whether the file is open into one thing.

102  \if@domarkers%
103  \addtocounter{postfig}{1}% % bj

104  \figureplace%              % bj
105  \fi%

\@currenvir \@currenvir (current environment) it set to fool latex into expecting the end of this environment to match the environment name. It will be used more extensively when dealing with the problem discussed in section 10.3.

106  \def\@currenvir{efloat@float}%

Now we set up catcodes for reading in text without processing things. But need to make ^^M special since we want to read line by line.

107  \begingroup%
108  \let\do\ef@makeinnocent \dospecials%
109  \ef@makeinnocent\^^L% and whatever other special cases
110  \endlinechar`\^^M \catcode`\^^M=12 \ef@xfigure}%

\efloat@foundend When \ef@xfigure is verbatim-like reading the figure it has to do some cleanup after it as found the \end{figure} or \end{figure*}. This is it. [this part written by jpg v2.2]

111 \def\efloat@foundend#1#2{\def\next{\endgroup\end{efloat@float}%
112  \efloat@iwrite{#1}{\string\end{#2}}%
113  \efloat@iwrite{#1}{\string\efloatseparator}%
114  \efloat@iwrite{#1}{ }}}%

\ef@xfigure \ef@xfigure reads line by line, checking whether each line is the \end{figure}. If it is, then write out end stuff to the file. Otherwise write out read in line to the file and do the \next line.

115 {\catcode`\^^M=12 \endlinechar=-1 %
116 \gdef\ef@xfigure#1^^M{\def\test{#1}%
Test for \end{figure}
117  \ifx\test\ef@endfiguretest
118  \efloat@foundend{fff}{figure*}
Test for \end{figure*}
119  \else\ifx\test\ef@enddblfiguretest
120  \efloat@foundend{fff}{figure*}

Finally, if none of the above, we have a line of text in the body of the figure which should be written to the file.

121  \else%
122  \efloat@iwrite{fff}{#1}%
123  \let\next\ef@xfigure%
124  \fi \fi \next}%

125 }%

\ef@endfiguretest \ef@enddblfiguretest Generalizing these end… test so that they can be used for user specified floating environments will require more \expandafters then you can shake a stick at. I am not looking forward to taking on that task. I should look at the version control package to see what I can lift from there, since it must be the same problem.

126 {\escapechar=-1%
127 \xdef\ef@endfiguretest{\string\\end\string\{figure\string\}}%
128 \xdef\ef@enddblfiguretest{\string\\end\string\{figure*\string\}}%

129 }%

\table \table is the same as \figure. But I am not going to document it as much.

130 \def\table{\efloat@condopen{ttt}
131  \efloat@iwrite{ttt}{\string\begin{table*}}%
132  \if@domarkers
133  \addtocounter{posttbl}{1} % bj
134  \tableplace               % bj
135  \fi
136  \def\@currenvir{efloat@float}%
137  \begingroup
138  \let\do\ef@makeinnocent \dospecials
139  \ef@makeinnocent\^^L% and whatever other special cases
140  \endlinechar`\^^M \catcode`\^^M=12 \ef@xtable}
\ef@xtable
141 {\catcode`\^^M=12 \endlinechar=-1 %
142 \gdef\ef@xtable#1^^M{\def\test{#1}
143  \ifx\test\ef@enddbltabletest
144  \efloat@foundend{ttt}{table*}
145  \else\ifx\test\ef@endtabletest
146  \efloat@foundend{ttt}{table*}
147  \else
148  \efloat@iwrite{ttt}{#1}%
149  \let\next\ef@xtable
150  \fi \fi \next}

151 }

152 {\escapechar=-1
153 \xdef\ef@enddbltabletest{\string\\end\string\{table*\string\}}
154 \xdef\ef@endtabletest{\string\\end\string\{table\string\}}

155 }

Define starred floats.

156 \@namedef{figure*}{\figure}
157 \@namedef{table*}{\table}

15.7 Processing Figures and Tables

158 \providecommand{\figuresection}{Figures}
159 \providecommand{\tablesection}{Tables}
\AtBeginFigures \AtBeginTables \AtBeginDelayedFloats Here we set-up the hooks for getting stuff into \process... commands easily.

The command \g@addto@macro is defined in classes.dtx. I was about to write it myself, when I realized that it must already exist for things like

 \AtBeginDocument.
160 \newcommand{\processfigures@hook}{\@empty}
161 \def\AtBeginFigures{\g@addto@macro\processfigures@hook}
162 \newcommand{\processtables@hook}{\@empty}
163 \def\AtBeginTables{\g@addto@macro\processtables@hook}
164 \newcommand{\processdelayedfloats@hook}{\@empty}
165 \def\AtBeginDelayedFloats{%
166 \g@addto@macro\processdelayedfloats@hook}
167 \newcommand{\processotherdelayedfloats}{\@empty}
\processfigures
168 \def\processfigures{%

First test to see if there are any figures to process. If so do it.

169 \expandafter\ifnum \csname @ef@fffopen\endcsname>0

Close the file for writing. Set a flag saying so.

170 \immediate\closeout\efloat@postfff \ef@setct{fff}{0}

Deal with headers and list of figures if necessary

171 \clearpage                                                        % bj
172 \if@figlist                                                       % bj
173  {\normalsize\listoffigures}                                     % bj
174  \clearpage                                                      % bj
175 \fi
176 \if@fighead
177  \section*{\figuresection}                                   % bj

See the discussion in section 15.7.1 for what problem the suppressfloats[t] is here to solve. If I understand the Companion correctly (page 144), this was not available in previous versions of L^{A}TEX.

178  \suppressfloats[t]                                          % jpg
179 \fi
180 \markboth{\uppercase{\figuresection}}{\uppercase{\figuresection}}% bj

Use any user defined hooks just before inputting the file.

181 \processfigures@hook \@input{\jobname.fff}
182 \fi}

\processtables Just like \processfigures, only not so well documented.

183 \def\processtables{%
184 \expandafter\ifnum \csname @ef@tttopen\endcsname>0
185 \immediate\closeout\efloat@postttt \ef@setct{ttt}{0}
186 \clearpage                                                      % bj
187 \if@tablist                                                     % bj
188  {\normalsize\listoftables}                                    % bj
189  \clearpage                                                    % bj
190 \fi
191 \if@tabhead
192  \section*{\tablesection}                                  % bj
193  \suppressfloats[t]                                        % jpg
194 \fi
195 \markboth{\uppercase{\tablesection}}{\uppercase{\tablesection}}% bj
196 \processtables@hook \@input{\jobname.ttt}
197 \fi}

15.7.1 Getting float placement correct

In versions prior to this attempt (v2.2c), when the heads options were used, the float could could either float to the next page, leaving the section header alone, or could float to the top of the page, leaving section header at the bottom of the page. The idea here is to change the parameters that place floats, to very very strongly encourage floats at the bottom of pages. It also allows for easy top floats. Thus obviating the need for float pages. A \suppressfloats[t] in the commands that issue the headers will make sure that the floats don’t float above the headers.

198 \renewcommand{\bottomfraction}{1.0}
199 \renewcommand{\topfraction}{1.0}
200 \renewcommand{\textfraction}{0.0}

15.7.2 Calling the processing commands

Note that there is an extra set { and } so that the restoration of the original definitions is in a group and is not global. If, for some reason, you wish them to be global then use something like

   \makeatletter
   \AtBeginDelayedFloats{\global\let\table\@btab \global\let\figure\@bfig}
   \makeatother
\processdelayedfloats
201 \newcommand{\processdelayedfloats}{{%

Here we reset stuff to apply while end stuff is being processed. Prior to version

 2.4, these were in \processtablels and \processfigures.
202 \def\baselinestretch{1}\normalsize
203 \let\figure\@bfig
204 \let\table\@btab

The hook comes after those settings so as to override them if desired.

205 \processdelayedfloats@hook

Process tables, figures, and others (or figures, tables, others)

206 \if@tablesfirst \processtables\processfigures
207 \else \processfigures\processtables \fi
208 \processotherdelayedfloats}}
209 \AtEndDocument{%                                      % jpg
210 \message{AED endfloat: Processing end Figures and Tables}% % jpg
211 \onecolumn
212 \processdelayedfloats }

Use, or don’t use, configuration file.

213 \InputIfFileExists{endfloat.cfg}{%
214 \typeout{*** Using endfloat.cfg ***}}{}

215 ⟨/package⟩

16 Extra macros – HIGHLY Experimental

16.1 Getting new delayed environments

I have been promising to make it easy to define new sorts of environments which can be delayed. I don’t expect to deliver on that promise any time soon; so until I do, I will provide a couple of useful extra macros in a configuration fill which the user may experiment with. The two that I have needed are used in conjunction with the rotating package[5], which among other things provides environments sidewaystable and sidewaysfigure. With the following definitions, these should also work properly with endfloat.

216 ⟨∗config⟩

217 % Warning!  This configuration file is experimental and
218 % will probably only work with the version of endfloat.sty
219 % with which it is distributed.  It is fully expected that the
220 % mechanism by which the stuff here is done will change radically
221 % in future versions.  For detailed comments on this code see
222 % endfloat.dtx.

Setting up sidewaystable and sidewaysfigure is fairly easy since they will use the same counters as table and figure, and more importantly the same temporary files. So, no special \processsideways... needs to be created.

We must, of course, have use of the rotating package.

223 \RequirePackage{rotating}

First save the definitions from rotating of the environments in question, since they will need to be restored when they are processed at the end.

224 \let\efsaved@sidewaysfigure\sidewaysfigure
225 \let\efsaved@sidewaystable\sidewaystable

And to restore them when the time comes. These hooks are called by \processtables and \processfigures. We use the hooks to restore the original definitions of sideways....

226 \AtBeginTables{\let\sidewaystable=\efsaved@sidewaystable\relax}
227 \AtBeginFigures{\let\sidewaysfigure=\efsaved@sidewaysfigure\relax}

\sidewaystable This redefinition of sidewaystable is very similar to the redefinition of \table in endfloat proper. When a \begin{sidewaystable} is expanded, it will write

\begin{sidewaystable} to \jobname.ttt and otherwise do what it does for a

\begin{table}, except of course that it is looking for an \end{sidewaystable}.

228 \def\sidewaystable{\efloat@condopen{ttt}
229  \efloat@iwrite{ttt}{\string\begin{sidewaystable}}%
230  \if@domarkers
231  \addtocounter{posttbl}{1}
232  \tableplace
233  \fi
234  \def\@currenvir{efloat@float}%
235  \begingroup
236  \let\do\ef@makeinnocent \dospecials
237  \ef@makeinnocent\^^L% and whatever other special cases
238  \endlinechar`\^^M \catcode`\^^M=12 \ef@xsidetable}

\ef@xsidetable The definition of \ef@xsidetable is similar to the definition of \ef@xtable in endfloat proper. It is a little bit simpler, since there is no need to worry about the *-ed versions. Note that it writes out verbatim the environment to the .ttt file. When it finds a line that satisfies the \ef@endsidetabletest it will call a

macro that will write \end{sidewaystable} to the \jobname.ttt file.
239 {\catcode`\^^M=12 \endlinechar=-1 %
240 \gdef\ef@xsidetable#1^^M{\def\test{#1}
241  \ifx\test\ef@endsidetabletest
242  \efloat@foundend{ttt}{sidewaystable}
243  \else
244  \efloat@iwrite{ttt}{#1}%
245  \let\next\ef@xsidetable
246  \fi \next}

247 }

Now figures

\sidewaysfigure
248 \def\sidewaysfigure{\efloat@condopen{fff}
249  \efloat@iwrite{fff}{\string\begin{sidewaysfigure}}%

250  \if@domarkers
251  \addtocounter{postfig}{1}
252  \figureplace
253  \fi
254  \def\@currenvir{efloat@float}%
255  \begingroup
256  \let\do\ef@makeinnocent \dospecials
257  \ef@makeinnocent\^^L% and whatever other special cases
258  \endlinechar`\^^M \catcode`\^^M=12 \ef@xsidefigure}
\ef@xsidefigure
259 {\catcode`\^^M=12 \endlinechar=-1 %
260 \gdef\ef@xsidefigure#1^^M{\def\test{#1}
261  \ifx\test\ef@endsidefiguretest
262  \efloat@foundend{fff}{sidewaysfigure}
263  \else
264  \efloat@iwrite{fff}{#1}%
265  \let\next\ef@xsidefigure
266  \fi \next}

267 }

We need the strings to test for ends of the sideways things.

268 {\escapechar=-1%
269 \xdef\ef@endsidefiguretest{\string\\end\string\{sidewaysfigure\string\}}%
270 \xdef\ef@endsidetabletest{\string\\end\string\{sidewaystable\string\}}}%

271 ⟨/config⟩