表格位置:[p] 是否启用强制新页面模式?

表格位置:[p] 是否启用强制新页面模式?

在我的文档中,我制作了第一个表格以放置在特殊页面上。但所有后面的表格也将转到此页面,而不管我使用的任何定位参数。

\documentclass{article}

\begin{document}
\ldots

\begin{table}[p]       % this [p] affects the following tables
\begin{tabular}{|c|}
1
\end{tabular}
\end{table}

\begin{table}[ht]
\begin{tabular}{|c|}
2
\end{tabular}
\end{table}

\begin{table}[!b]
\begin{tabular}{|c|}
3
\end{tabular}
\end{table}

\ldots
\end{document}

我认为定位参数只对其自己的表负责。是否可以将其他表从强制放置在单独的页面上释放出来?

答案1

我认为你需要做的是,为了达到预期身体的3 个浮点数的排序table是为了加载afterpage包并使用\afterpage宏。

具体来说,我建议您将环境代码包含[p] table在一个\afterpage指令中,有效地告诉 LaTeX 推迟或推迟处理该浮点数(其标题将为“3”)直到下一页开始。这种推迟反过来又让 LaTeX 可以处理队列中的下一个浮点数。如果“下一个浮点数”由两个恰好适合当前页面的浮点数组成,那么 LaTeX 完全可以接受。

但请注意,浮动元素 2 和 3 的标题现在实际上将被编号为“1”和“2”,因为从物理意义上讲,这两个浮动元素现在位于通过设备放置在仅浮动元素页面上的浮动元素之前\afterpage

以下代码希望能进一步解释这一点。请注意,我删除了tabular环境并\caption改为引入语句。

\documentclass{article}
\usepackage{afterpage}
\usepackage{lipsum} % filler text
\begin{document}
\lipsum[1]  % to occupy the top of p. 1

\afterpage{%
\begin{table}[p]     % this float is placed on page 2 
\caption{AAA}        % caption is given number "3"
\end{table}
\clearpage}          % nothing else on this page

\begin{table}[ht]    % this float is placed immediately after lips-1 para
\caption{BBB}        % caption is given number "1"
\end{table}

\begin{table}[!b]    % this float is placed at the bottom of page 1
\caption{CCC}        % caption is given number "2"
\end{table}

\lipsum[2]           % this para is placed below table "1" ("BBB")
\end{document}

答案2

我不太清楚你想在你的特殊页面上放什么。下面的代码将表格p单独放在一个页面上,任何后续表格都根据其特定的放置规范进行定位。浮动放置仅适用于特定的浮动。在你的 MWE 中,表格p放在下一页,但不会占据整个页面,为其他浮动留出空间。

% pposprob.tex  SE 619028

\documentclass{article}
\usepackage{lipsum}

\begin{document}
\lipsum[1]  % on page 1

\begin{table}[p]     % on next page (2) and is the only thing
\caption{\texttt{p} table}
\end{table}

\clearpage


\begin{table}[ht]     % on top of page 3
\caption{\texttt{ht} table}
\end{table}

\begin{table}[!b]     % on bottom  of page 3
\caption{\texttt{!b} table}
\end{table}

\lipsum[2]       % on page 3

\end{document}

相关内容