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?
1 Answer
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}
endfloat
active and once without it. You could then useincludepdf
to include the last pages with the figures to the normal version. It's a little more work, but should do the trick.