For a paper I'm working on they want to have an appendix with all the figures from the main text. That is, figures should be in the main text (for publication), but they should be repeated in an appendix (for easy reviewing). Is there any package that does this? If not, how would I go about renewing the figure environment to create such an appendix?
Asked
Active
Viewed 1,619 times
8
1 Answers
7
It's just a matter of gathering the figures during the document in a token register, to be delivered at the end. By changing the counter we ensure that the figures are renumbered in the correct way.
\documentclass[a4paper]{article}
\usepackage{environ}
\makeatletter
\let\@@figure\figure
\let\@@endfigure\endfigure
\let\figure\@undefined
\let\endfigure\@undefined
\newtoks\end@figuretoks
\NewEnviron{figure}[1][htp]{%
\@@figure[#1]\BODY\@@endfigure
\global\end@figuretoks=\expandafter{\the\end@figuretoks\@@figure[p]}%
\global\end@figuretoks=\expandafter{\the\expandafter\end@figuretoks\BODY\@@endfigure}%
}
\newcounter{Endfigure}
\AtEndDocument{\clearpage\let\c@figure\c@Endfigure\the\end@figuretoks}
\makeatother
\usepackage{lipsum}
\begin{document}
\title{A document}
\author{A. N. Author}
\maketitle
\lipsum[1]
\begin{figure}[t]
\centering
1abc
\caption{def}
\end{figure}
\lipsum[2-4]
\begin{figure}
\centering
2abc
\caption{def}
\end{figure}
\lipsum[2-4]
\begin{figure}
\centering
3abc
\caption{def}
\end{figure}
\lipsum[2-4]
\begin{figure}
\centering
4abc
\caption{def}
\end{figure}
\lipsum[2-4]
\end{document}
egreg
- 1,121,712
endfloatactive and once without it. You could then useincludepdfto include the last pages with the figures to the normal version. It's a little more work, but should do the trick. – Martin Scharrer Dec 19 '11 at 08:51