对于我当前的项目,我需要多个表格,其中包含 2 列,跨越多个页面,并且全部双列模式!如果我没错的话,Supertabular 应该是正确的选择。
问题是,我经常在完全没有必要的地方遇到不必要的分页符。
MWE (2 次 LaTeX 运行):
\documentclass{article}
\usepackage[debugshow]{supertabular}
\usepackage{lipsum}
\usepackage{geometry}
\usepackage{forloop}
\geometry{a4paper, twocolumn, columnsep=10mm, top=10mm, left=10mm, right=10mm, bottom=10mm,
headsep=0mm, footskip=0mm}
\begin{document}
\newcommand\writemytable[1]{%
\subsubsection*{Subsubsection}
\lipsum[1]
\tablefirsthead{Col A & Larger Column B \\ \hline}%
\begin{supertabular}{p{10mm}@{\hspace{2mm}}|@{\hspace{2mm}}p{76mm}}
\forloop{mycounterB}{1}{\value{mycounterB} < #1}{\themycounterB & \lipsum[#1] \\}
last & line \\
\end{supertabular}
}
\newcounter{mycounterA}%
\newcounter{mycounterB}%
\newcounter{mycounterC}%
\forloop{mycounterA}{1}{\value{mycounterA} < 3}{
\forloop{mycounterC}{1}{\value{mycounterC} < 9}{
\writemytable{\themycounterC}
}
}
\end{document}
例如,此处第 4 页,整个下一个表格被移动到下一页列。我针对有问题的表格获取了以下日志:
Starting a new supertabular
Average line height: 13.0pt
Stretched line height: 1.0pt
Calculating height of tabular on first page
Height of text = 381.45132pt;
Height of page = 788.14136pt
two column mode
First column
Available height: 406.69003pt
Height of head: 12.4pt
Height of tail: 15.5pt
Maximum height of tabular: 406.69003pt
Minimum height of tabular: 40.9pt
Space left for tabular: 393.69003pt
Added par box with height 178.54448pt
Space left for tabular: 196.29002pt
Added par box with height 178.54448pt
Space left for tabular: -1.10999pt
Tabular too high, moving to next page
Added par box with height 178.54448pt
Space left for tabular: 184.88577pt
Starting new page, writing tail
Calculating height of tabular on next page
Maximum height of tabular: 788.14136pt
writing head
Added par box with height 178.54448pt
Space left for tabular: 590.74135pt
Added par box with height 178.54448pt
Space left for tabular: 393.34134pt
Added par box with height 178.54448pt
Space left for tabular: 195.94133pt
Space left for tabular: 182.94133pt
Ended a supertabular
一定是算计错了……
总而言之:浪费了太多空间,这是不可接受的 :-(
如果有其他更好的方案可以实现这个功能,请告诉我。
编辑:我写了自己的解决方案这里。