[Tex/LaTex] Restart float numbering with endfloat with labels

appendicesendfloatfloats

I need to restart figure numbering in the Appendix, so that figures are 1, 2, ..; then S1, S2, …. Unfortunately, I can't figure out how to have endfloat refer to the two groups of figures differently. What I would like to have happen is as in the following code (without endfloat):

\documentclass{article}
\usepackage[draft]{graphicx}
% \usepackage{endfloat}
\begin{document}

As we see in figure \ref{fig1} (and also in supplemental figure \ref{figS1}) \ldots

\begin{figure}
  \includegraphics{fig1}
  \caption{ One.  } \label{fig1}
\end{figure}

\clearpage
\renewcommand{\thefigure}{S\arabic{figure}}
\setcounter{figure}{0}

\begin{figure}
    \includegraphics{figS1}
  \caption{ Supplement, one.  } \label{figS1}
\end{figure}

\end{document}

… but uncommenting endfloat (and deleting temporary files) causes the text and list of figures to refer to S1 and S2 (instead of 1 and S1), and the [Figure X about here] to refer to 1 and 2.

Best Answer

The counter postfigure needs to also be reset, like so:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage[nofiglist]{endfloat}

\begin{document}

\listoffigures
\clearpage

\section{Test}
As we see in figure \ref{fig1} (and also in supplemental figure \ref{figS1}) \ldots
\begin{figure}
  \includegraphics{fig1}
  \caption{ One.  } \label{fig1}
\end{figure}
\processdelayedfloats

\clearpage
\appendix
\section{Appendix}
\renewcommand{\thefigure}{S\arabic{figure}}
\renewcommand{\thepostfigure}{S\arabic{postfigure}}
\setcounter{figure}{0}
\setcounter{postfigure}{0}

\begin{figure}
    \includegraphics{figS1}
  \caption{ Supplement, one.  } \label{figS1}
\end{figure}
\processdelayedfloats

\end{document} 

Output

enter image description here


enter image description here


enter image description here

Related Question