LaTeX にすべての図を PDF ファイルの最後に配置するように指示するにはどうすればよいでしょうか?

LaTeX にすべての図を PDF ファイルの最後に配置するように指示するにはどうすればよいでしょうか?

SE サイトを検索してみましたが、他の全員が図の追加を避ける方法を尋ねているようで、彼らの偶然は私の問題に対するあまりエレガントな解決策ではありません --- 図をテキスト内の出現位置に保持するか、相対的な順序を維持しながらすべてをファイルの最後 (参考文献を含むすべてのテキストの後) にスイープする方法 (可能であれば 1 行のコマンド) を探しています。何かアイデアはありますか?

答え1

最初の(リスクのある(以下のリンクを参照))可能性(浮動小数点演算を抑制し、コード内で宣言された場所にすべての数字を正確に表示させる)では、floatパッケージとその\floatplacementコマンドを指定子とともに指定しますH

\documentclass{article}
\usepackage{float}
\floatplacement{figure}{H}

\begin{document}
<contents>
\end{document}

もちろん、これにはいくつかの欠点があります。`H` 指定子の欠点

2番目の方法(すべての図を文書の最後に移動する)では、endfloatパッケージを使用できます。たとえば、次のようになります。

\documentclass{article}
\usepackage[nomarkers,figuresonly]{endfloat}

\begin{document}
<contents>
\end{document}

figure環境 (nortableまたは他のユーザー定義のフロート) のみがドキュメントの末尾に配置され、図が元々あった場所にはマーカーは生成されません。

パッケージが提供するその他のすべてのオプションを確認するには、パッケージのドキュメントを参照してください。

答え2

また、イチジクの実\figcapsonパッケージには、すべての float を(デフォルトで有効)と の末尾に転送する 2 つの簡単なスイッチがあります\figcapsoff

\documentclass{article}
\usepackage[printfigures]{figcaps} % printfigures to display figure floats
%\figcapsoff % enable to keep floats in their positions 

\begin{document}
<contents>
\end{document}

には よりもはるかに少ないオプションがfigcaps付属しておりendfloat、図自体に加えて図のキャプションが印刷されないようにする (簡単な) 方法はないようです。

答え3

どちらもfigcapsendFloatの場合、意図したとおりには機能しません。私の写真の一部は横向きモードであり、本文と付録の図を区別したいからです。

少し冗長ではありますが、この回避策は非常にうまく機能しますが、これを実行するためのより便利な方法があれば教えてください。

MWE:

\documentclass[a4paper,12pt]{scrartcl}


\usepackage{blindtext} % lorem ipsum
\usepackage{chngcntr} % for renumbering appendix 
\usepackage{comment}  % for choosing placement of figure in text (W for the "work-in-progress" and S for "submit" version)

\usepackage{pdflscape}      %adds PDF support to the landscape environment of package lscape
\usepackage{graphicx}

\usepackage{flafter} % no figures before section headings

% creating a conditional
\newif\ifS

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% set this to false if you want the figures in the text
% and to true if you want them at the end (S stands for "submit")

\Strue % \Sfalse or \Strue
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%this tells the comment-package which parts to include and exclude
\ifS
    \includecomment{S}
    \excludecomment{W}
\else
    \excludecomment{S}
    \includecomment{W}
\fi

%---------------------------------------
\begin{document}

\section{Intro}

% define figure1
\newcommand{\figureA}{
\begin{figure}
\includegraphics[width=\textwidth]{example-image-a} 
\caption{figureA}
\label{fig:figureA}
\end{figure}
}

%place figure1 if this is the the work-in-progress (W) version
\begin{W}
\figureA
\end{W}

%define figure2
\newcommand{\figureB}{
\begin{landscape}\begin{figure}[!htb]
\includegraphics[width=\textwidth,height=\textheight,keepaspectratio]{example-image-B}
\caption{figureB} 
\label{fig:figureB}
\end{figure}
\end{landscape}
}

%place figure 2 if the work-in-progress (W) version
\begin{W}
\figureB
\end{W}

\Blindtext % lorem ipsum

%-----------------------------------------------
% When it is time to submit and you want your figures at the end, you can place your figures & tables at the end, but before appendix.
% Remember that this controlled by \Strue & \Sfalse in the preabmle

\cleardoublepage

\begin{S}
\listoffigures
\figureA
\figureB
\end{S}

%------------------------------------------
\cleardoublepage
\appendix
\counterwithin{figure}{section} 
\counterwithin{table}{section}
\section{Appendix}\label{appendix}



\begin{figure}[!htb]
\includegraphics[width=8cm]{example-image-golden}
\caption{Golden}
\label{fig:Golden}
\end{figure}



\begin{figure}[!htb]
\includegraphics[width=8cm]{example-grid-100x100pt}
\caption{Grid}
\label{fig:Grid}
\end{figure}


\end{document}

関連情報