Latex 改变了我文档中浮动元素的顺序。它将图 2 移到了图 1 之前。图 1 占据了整整一页,因此我在 afterpage 环境中将其设置为插入到浮动页面中。如何确保所有浮动元素都按照它们在文档中定义的顺序出现?以下是一个例子:
\documentclass{article}
\pagestyle{plain}
\usepackage{calc}
\usepackage{setspace}
\onehalfspacing
\usepackage[english]{babel}
\usepackage[pangram]{blindtext}
\usepackage{caption}
\usepackage{floatrow}
\usepackage{afterpage}
\setlength{\textfloatsep}{20pt}
\setlength{\intextsep}{20pt}
\begin{document}
\vspace*{0.9\textheight}
\blindtext[8] (See Figure \ref{Fig1}) \blindtext[8]
\afterpage{
\begin{figure}[p]
\ffigbox[\FBwidth]{%
\framebox{\begin{minipage}[t][0.8\textheight]{0.8\textwidth}%
\hspace*{\fill}%
\end{minipage}}}{\caption{\label{Fig1}This is figure 1. \blindtext[8]}}
\end{figure}
\clearpage }
\blindtext[34] (See Figure \ref{Fig2}). \blindtext[12]
\begin{figure}
\ffigbox[\FBwidth]{%
\framebox{\begin{minipage}[t][3cm]{0.8\textwidth}%
\hfill{}%
\end{minipage}}}{\caption{\label{Fig2}This is figure 2. \blindtext[4]}}
\end{figure}
\blindtext[10] (See Figure \ref{Fig3}) \blindtext[5]
\begin{figure}
\noindent \centering{}\ffigbox[\FBwidth]{%
\framebox{\begin{minipage}[t][0.3\textheight]{0.8\textwidth}%
\hspace*{\fill}%
\end{minipage}}}{\caption{\label{Fig3}This is figure 3. \blindtext[4] }}
\end{figure}
\end{document}
pdf 结果如下:
答案1
这里唯一\afterpage
要做的就是将浮点数从默认排序中取出,然后将其删除。
\documentclass{article}
\pagestyle{plain}
\usepackage{calc}
\usepackage{setspace}
\onehalfspacing
\usepackage[english]{babel}
\usepackage[pangram]{blindtext}
\usepackage{caption}
\usepackage{floatrow}
\usepackage{afterpage}
\setlength{\textfloatsep}{20pt}
\setlength{\intextsep}{20pt}
\begin{document}
\vspace*{0.9\textheight}
\blindtext[8] (See Figure \ref{Fig1}) \blindtext[8]
\begin{figure}[p]
\ffigbox[\FBwidth]{%
\framebox{\begin{minipage}[t][0.8\textheight]{0.8\textwidth}%
\hspace*{\fill}%
\end{minipage}}}{\caption{\label{Fig1}This is figure 1. \blindtext[8]}}
\end{figure}
\blindtext[34] (See Figure \ref{Fig2}). \blindtext[12]
\begin{figure}
\ffigbox[\FBwidth]{%
\framebox{\begin{minipage}[t][3cm]{0.8\textwidth}%
\hfill{}%
\end{minipage}}}{\caption{\label{Fig2}This is figure 2. \blindtext[4]}}
\end{figure}
\blindtext[10] (See Figure \ref{Fig3}) \blindtext[5]
\begin{figure}
\noindent \centering{}\ffigbox[\FBwidth]{%
\framebox{\begin{minipage}[t][0.3\textheight]{0.8\textwidth}%
\hspace*{\fill}%
\end{minipage}}}{\caption{\label{Fig3}This is figure 3. \blindtext[4] }}
\end{figure}
\end{document}