我遇到了与这篇文章中描述的相同的问题: 将 endfloat 与 sidewaystable 和 longtable 结合使用
我会在论文末尾展示一张超过两页且横向的长表。
在我看来 - sidewaystable 与 endfloat 配合良好 - longtable 在 Landscape 中配合良好 - Landscape 与 endfloat 不配合 - longtable 与 sidewaystable 不配合。
因此,我正在寻找一种如何结合 endfloat、sidewaystable/landscape 和 longtable 的方法。
示例代码:
\documentclass{article}
\usepackage{longtable}
\usepackage[
tablesonly,
notablist,
]{endfloat}
\usepackage{rotating}
\usepackage{pdflscape}
\DeclareDelayedFloatFlavor{sidewaystable}{table}
\DeclareDelayedFloatFlavour*{longtable}{table}
\begin{document}
\section{First section}
\begin{table}
\centering
\caption{1st Table: Standard table}
normal table works with endfloat
\end{table}
\begin{longtable}{l}
\caption{2nd Table: Longtable}\\
longtable works with endfloat
1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\
\end{longtable}
\begin{sidewaystable}
\centering
\caption{3rd Table: Sideways table}
sidewaystable works with endfloat
\end{sidewaystable}
\begin{landscape}
\begin{table}
\centering
\caption{4th Table: Landscape}
Landscape does not work with endfloat\\
\end{table}
\end{landscape}
\begin{sidewaystable}
\centering
\begin{longtable}{l}
\caption{5th Table: sidewaystable and longtable } \\
sidewaystable and longtable do not work together
1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\
\end{longtable}
\end{sidewaystable}
\section{Last section}
\end{document}
答案1
该endfloat
包的工作原理是将特定环境完整复制到 ttt 文件中(用于表格)。因此,我为 sideways 创建了一个新环境longtable
并将其添加到列表中。
注意:pdflscape
使侧面的文本看起来正面朝上,而 则sidewaystable
不然。
\documentclass{article}
\usepackage{longtable}
\usepackage[
tablesonly,
notablist,
]{endfloat}
\usepackage{rotating}
\usepackage{pdflscape}
\newenvironment{longsidewaystable}[1]{\landscape\longtable{#1}}{\endlongtable\endlandscape}
\DeclareDelayedFloatFlavor{sidewaystable}{table}
\DeclareDelayedFloatFlavour*{longtable}{table}
\DeclareDelayedFloatFlavour*{longsidewaystable}{table}
\begin{document}
\section{First section}
\begin{table}
\centering
\caption{1st Table: Standard table}
normal table works with endfloat
\end{table}
\begin{longtable}{l}
\caption{2nd Table: Longtable}\\
longtable works with endfloat
1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\
\end{longtable}
\begin{sidewaystable}
\centering
\caption{3rd Table: Sideways table}
sidewaystable works with endfloat
\end{sidewaystable}
\begin{longsidewaystable}{l}
\caption{4th Table: Longtable}\\
longsidewaystable works with endfloat
1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\
\end{longsidewaystable}
\section{Last section}
\end{document}