
付録の図の番号付けをやり直して、図が 1、2、...、その後 S1、S2、... となるようにする必要があります。残念ながら、endfloat で 2 つの図のグループを別々に参照する方法がわかりません。次のコードのようにしたいです (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 のコメントを解除し (一時ファイルを削除すると)、テキストと図のリストは (1 と S1 ではなく) S1 と S2 を参照し、 は[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}