如何告訴LaTeX將所有數字放在pdf檔的末端?

如何告訴LaTeX將所有數字放在pdf檔的末端?

好吧,我搜尋了SE 網站,但似乎其他人都在問如何避免附加數字,他們的意外並不是解決我的問題的一個優雅的解決方案--- 我正在尋找一種方法(如果可能的話,使用一行命令),所以我可以將數字保留在文本中出現的位置,或者將所有數字掃到文件的最後(在所有文本包括參考書目之後),同時保持它們的相對順序。有任何想法嗎?

答案1

對於第一種(有風險(請參見下面的連結))可能性(強制所有數字準確地出現在程式碼中聲明的位置,抑制浮動),您可以使用float包及其\floatplacement命令以及H說明符:

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

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

當然,這有一些缺點:‘H’說明符的缺點

對於第二個(將所有數字移至文件末尾),endfloat可以使用包。例如,以下內容:

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

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

只會導致figure環境(也不是table或其他使用者定義的浮點數)放置在文件的末尾,並且不會在數字最初所在的位置產生任何標記。

請參閱包文件以查看它提供的所有其他選項。

答案2

還有無花果帽包,它有兩個簡單的開關,用於將所有浮點數轉發到末尾\figcapson(預設啟用)和\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

兩者都不figcaps適合endFloat我,因為我的一些照片是橫向模式,我想將正文和附錄中的人物分開。

雖然有點冗長,但這種解決方法效果很好,但很高興聽到是否有更方便的方法來做到這一點。

微量元素:

\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}

相關內容