
Мне нужно перезапустить нумерацию фигур в Приложении, чтобы фигуры были 1, 2, ..; затем S1, S2, .... К сожалению, я не могу понять, как сделать так, чтобы endfloat ссылался на две группы фигур по-разному. Я бы хотел, чтобы произошло так, как в следующем коде (без 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}
... но раскомментирование endfloat (и удаление временных файлов) приводит к тому, что текст и список рисунков ссылаются на S1 и S2 (вместо 1 и S1), а [Figure X about here]
ссылаются на 1 и 2.
решение1
Счетчик postfigure
также необходимо сбросить, вот так:
\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}
Выход
решение2
Счетчик, используемый для нумерации «на месте», называется postfigure
, поэтому его также следует изменить.
Вот решение, которое эксплуатирует \appendix
. Инструкция по изменению представления счетчика и сбросу счетчика записана в .fff
файле, поэтому она вступит в действие, когда произойдет фактический набор цифр.
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{endfloat}
\usepackage{etoolbox}
\makeatletter
\appto{\appendix}{%
\renewcommand{\thepostfigure}{S\arabic{postfigure}}%
\setcounter{postfigure}{0}%
\efloat@iwrite{fff}{%
\unexpanded{%
\renewcommand{\thefigure}{S\arabic{figure}}^^J%
\setcounter{figure}{0}^^J%
}%
}%
}
\makeatother
\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 % not necessary, just to make the figure go to the next page
\appendix
\begin{figure}
\includegraphics{figS1}
\caption{Supplement, one.} \label{figS1}
\end{figure}
\renewcommand{\thefigure}{\arabic{figure}}
\end{document}
Для создания рисунка высота страницы была искусственно уменьшена.
ОБНОВЛЯТЬ
К сожалению, endfloat
версия 2.6 ввела ошибку, которая не позволит ей работать так, как ожидалось, а также сломает код выше. Пакет изменился \immediate\write
на \immediate\protected@write{}
, что неправильно, поскольку \immediate
не может работать в этой ситуации.
Обновленный код:
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{endfloat}
\usepackage{etoolbox}
\makeatletter
% fix the wrong code in endfloat.sty
\@ifundefined{protected@iwrite}{%
\let\protected@iwrite\protected@write
\patchcmd{\protected@iwrite}{\write}{\immediate\write}{}{}%
\def\efloat@iwrite#1{\expandafter\protected@iwrite\csname efloat@post#1\endcsname{}}%
}{}
% double 'unexpansion' now is needed
\appto{\appendix}{%
\renewcommand{\thepostfigure}{S\arabic{postfigure}}%
\setcounter{postfigure}{0}%
\efloat@iwrite{fff}{%
\unexpanded{\unexpanded{%
\renewcommand{\thefigure}{S\arabic{figure}}^^J%
\setcounter{figure}{0}^^J%
}}%
}%
}
\makeatother
\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 % not necessary, just to make the figure go to the next page
\appendix
\begin{figure}
\includegraphics{figS1}
\caption{Supplement, one.} \label{figS1}
\end{figure}
\renewcommand{\thefigure}{\arabic{figure}}
\end{document}