38

Well, I search through the SE site but it seems everyone else was asking how to avoid appending figure and their accidents are not quite an elegant solution to my problem --- I'm looking for a way (one line command if possible) so that I can either keep the figures where they appear within the text, or sweep all to the very end of file (after all text including bibliography) while maintaining their relative order. Any ideas?

  • I just had to do this and physically moved the code. For some reason, it didn't occur to me to search for a better solution. That said, what I needed was all tables moved, which I think means anything tabular-like. Mine happened to be a figure, though. – cfr Mar 7 '14 at 2:16
  • 8
    @cfr You could have used \usepackage[nomarkers,tablesonly]{endfloat}. – Gonzalo Medina Mar 7 '14 at 2:18
  • @GonzaloMedina Thanks but I think your answer would work better because I actually have \begin{figure}\begin{tabular}... and I don't have any non-tabular figures. So I think your answer would move everything to the end correctly. (The system won't accept my .tex file anyway so I didn't actually get anywhere by moving anything. Hence maybe I'll try your solution and move the thing back after getting (hopefully) some instructions.) – cfr Mar 7 '14 at 2:27
  • I wonder anyone could ever have problem with this. I'm trying to get LaTeX stop putting all the images at the end of the document. – Tomáš Zato Mar 15 '15 at 15:29
36

For the first (risky (see link below)) possibility (force all figures to appear exactly where they are declared in the code, suppressing flotation), you can use the float package and its \floatplacement command together with the H specifier:

\documentclass{article}
\usepackage{float}
\floatplacement{figure}{H}

\begin{document}
<contents>
\end{document}

Of course, this has some drawbacks: Drawbacks of the `H` specifier.

For the second one (moving all figures to the end of the document), the endfloat package can be used. For example, the following:

\documentclass{article}
\usepackage[nomarkers,figuresonly]{endfloat}

\begin{document}
<contents>
\end{document}

will cause just figure environments (nor table or other user-defined floats) to be placed at the end of the document and won't produce any marker in the place where the figures originally were.

Refer to the package documentation to see all the other options it offers.

  • 3
    The endfloat package seems like the way to go, but it reports errors like this AED endfloat: Processing end Figures and Tables ! Undefined control sequence. \@enddocumenthook ...igures and Tables}\onecolumn \processdelayedfloats l.638 \end{document} after I put it in one of the documents I have. No idea how to debug this... – nye17 Mar 7 '14 at 2:19
  • 2
    @nye17 reduce the code to a minimal document reproducing the error and open a fresh new question posting there the offending minimal code. – Gonzalo Medina Mar 7 '14 at 2:20
  • @GonzaloMedina Thanks! Any obvious/easy way to force the figures to be resized to fit automatically? Some of mine appear too big to see the whole figure and caption when I use your endfloat line. – Jesse W. Collins Nov 17 '16 at 2:47
4

There is also the figcaps package, which has two simple switches to forward all floats to the end in \figcapson (enabled by default) and \figcapsoff.

\documentclass{article}
\usepackage[printfigures]{figcaps} % printfigures to display figure floats
%\figcapsoff % enable to keep floats in their positions 

\begin{document}
<contents>
\end{document}

Do note that figcaps comes with far fewer options than endfloat and there seems to be no (easy) way to prevent it from printing the figure captions in addition to the figures themselves if you don't want them.

  • 1
    Thank you for this solution. For the record, @GonzaloMedina's solution moves only the figures in the end of the document, where this also moves the tables. – Aventinus Jul 31 '18 at 15:19

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.