0

The endfloat package moves all figure floats to the end of the file. Is it possible to do this BUT also keep original floats?

I.e. basically this would simply duplicate the floats to the end of the file.

  • 3
    A rephrasing of the title would make this more informative for quick inspection. How about "Is it possible for endfloat to keep figures at their original locations as well as placing them at the end?" – barbara beeton Sep 27 '19 at 18:35
  • The problem is that you cannot put \begin{figure} ... \end{figure} inside another environment (see page 15), nor does it use something like \BODY. AFAICT, it patches the LaTeX text reader to copy the text line by line once it detects the needed cues. OTOH, one can use the @float{figure} environment to bypass endfloat. – John Kormylo Sep 28 '19 at 21:29
2

This is a three pass solution. The first pass runs endfloat in order to create the .fff file. The second pass disables endfloat and uses the .fff file. However, the list of figures will not be accurate until the third pass.

Note: the disabled version still needs endfloat to define macros like \processdelayedfloats and\efloatseparator.

\documentclass{article}
\usepackage{endfloat}% first pass only
%\usepackage[disable]{endfloat}% second/third pass

\IfFileExists{\jobname.fff}{\AtEndDocument{\setcounter{figure}{0}%
  \ifx\processdelayedfloats\empty% disabled
    \clearpage\listoffigures
    \clearpage\input{\jobname.fff}
  \fi}}{}

\begin{document}

\begin{figure}
  \caption{first}
\end{figure}

\begin{figure}
  \caption{second}
\end{figure}

\end{document}
  • Very creative solution. How is this a "three pass solution". It is only two passes. First run with endfloat enabled. Then run with endfloat disabled. – mu7z Oct 1 '19 at 18:45
  • Is it not possible to also have the figures at the end of the file have ` \AtBeginDelayedFloats{\pagenumbering{gobble}} ` – mu7z Oct 1 '19 at 18:50
  • \pagestyle{empty} should do it. The third pass is for \listoffigures (or just remove it). – John Kormylo Oct 1 '19 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.