![如果列以节标题开头,xtab/supertabular 会插入列分隔符](https://linux22.com/image/445641/%E5%A6%82%E6%9E%9C%E5%88%97%E4%BB%A5%E8%8A%82%E6%A0%87%E9%A2%98%E5%BC%80%E5%A4%B4%EF%BC%8Cxtab%2Fsupertabular%20%E4%BC%9A%E6%8F%92%E5%85%A5%E5%88%97%E5%88%86%E9%9A%94%E7%AC%A6.png)
背景信息
我正在创建一本包含数千种食谱的书,采用双栏布局。配料表可以很短,但也可以很长,所以我喜欢将表格拆分。
问题
当某一列以章节/节/小节标题开始时,它会引发列中断,从而使页面的大部分区域保持空白。
我迄今为止尝试过
和往常一样,我尝试了不同的文档类别,例如 scrbook、article。我尝试使用不同的包及其各自的环境,例如 supertabular 和 xtab。Longtable 在两列布局中不起作用。我还尝试了不同的编译器,即 XeLaTeX(我常用的)和 pdfLaTeX。我还删除了所有样式、makros(为 mwe 再次添加了一些)和字体。到目前为止,没有任何效果。
平均能量损失
\documentclass[10pt, a4paper, twocolumn]{book}
\usepackage{xtab}
\newcommand{\dummytable}{
\begin{xtabular}{rrl}
stuff like ingredients & 5 & g \\
stuff like ingredients & 3 & g \\
stuff like ingredients & 15 & g \\
stuff like ingredients & 1000 & g \\
stuff like ingredients & 3 & g \\
stuff like ingredients & 15 & g \\
stuff like ingredients & 1000 & g \\
\end{xtabular}
}
\newcommand{\dummytext}{This is some dummy text to reproduce my problem.}
\begin{document}
\section*{\textbf{1}: NUTRIENT AGAR}
\dummytable
\section*{\textbf{1a}: REACTIVATION WITH LIQUID MEDIUM 1}
\dummytable
\dummytext
\section*{\textbf{2}: BACILLUS PASTEURII MEDIUM}
\dummytable
\dummytext
\subsection*{Main sol. 1}
\dummytable
\dummytext
\section*{\textbf{3}: AZOTOBACTER MEDIUM}
\dummytable
\dummytext
\section*{\textbf{6}: ALLANTOIN MINERAL MEDIUM}
\dummytable
\section*{\textbf{7}: ANCYLOBACTER - SPIROSOMA MEDIUM}
\dummytable
\dummytext
\section*{\textbf{8}: BACILLUS "RACEMILACTICUS" MEDIUM}
\dummytable
\dummytext
\section*{\textbf{9}: VY/2 AGAR}
\dummytable
\dummytext
\section*{\textbf{9a}: VY/2, REDUCED MEDIUM}
\dummytable
\dummytext
\section*{\textbf{10}: ZYMOMONAS MEDIUM}
\dummytable
\dummytext
\section*{\textbf{11}: MRS MEDIUM}
\dummytable
\dummytext
\section*{\textbf{11a}: MODIFIED MEDIUM 11}
\dummytext
\subsection*{Main sol. 11}
\dummytable
\dummytext
\section*{\textbf{11b}: MRS MEDIUM (pre-reduced)}
\dummytable
\dummytext
\section*{\textbf{12}: SOIL EXTRACT MEDIUM}
\dummytable
\dummytext
\section*{\textbf{1}: NUTRIENT AGAR}
\dummytable
\section*{\textbf{1a}: REACTIVATION WITH LIQUID MEDIUM 1}
\dummytable
\dummytext
\section*{\textbf{2}: BACILLUS PASTEURII MEDIUM}
\dummytable
\dummytext
\subsection*{Main sol. 1}
\dummytable
\dummytext
\section*{\textbf{3}: AZOTOBACTER MEDIUM}
\dummytable
\dummytext
\section*{\textbf{6}: ALLANTOIN MINERAL MEDIUM}
\dummytable
\section*{\textbf{7}: ANCYLOBACTER - SPIROSOMA MEDIUM}
\dummytable
\dummytext
\section*{\textbf{8}: BACILLUS "RACEMILACTICUS" MEDIUM}
\dummytable
\dummytext
\section*{\textbf{9}: VY/2 AGAR}
\dummytable
\dummytext
\section*{\textbf{9a}: VY/2, REDUCED MEDIUM}
\dummytable
\dummytext
\section*{\textbf{10}: ZYMOMONAS MEDIUM}
\dummytable
\dummytext
\section*{\textbf{11}: MRS MEDIUM}
\dummytable
\dummytext
\section*{\textbf{11a}: MODIFIED MEDIUM 11}
\dummytext
\subsection*{Main sol. 11}
\dummytable
\dummytext
\section*{\textbf{11b}: MRS MEDIUM (pre-reduced)}
\dummytable
\dummytext
\section*{\textbf{12}: SOIL EXTRACT MEDIUM}
\dummytable
\dummytext
\section*{\textbf{1}: NUTRIENT AGAR}
\dummytable
\section*{\textbf{1a}: REACTIVATION WITH LIQUID MEDIUM 1}
\dummytable
\dummytext
\section*{\textbf{2}: BACILLUS PASTEURII MEDIUM}
\dummytable
\dummytext
\subsection*{Main sol. 1}
\dummytable
\dummytext
\section*{\textbf{3}: AZOTOBACTER MEDIUM}
\dummytable
\dummytext
\section*{\textbf{6}: ALLANTOIN MINERAL MEDIUM}
\dummytable
\section*{\textbf{7}: ANCYLOBACTER - SPIROSOMA MEDIUM}
\dummytable
\dummytext
\section*{\textbf{8}: BACILLUS "RACEMILACTICUS" MEDIUM}
\dummytable
\dummytext
\section*{\textbf{9}: VY/2 AGAR}
\dummytable
\dummytext
\section*{\textbf{9a}: VY/2, REDUCED MEDIUM}
\dummytable
\dummytext
\section*{\textbf{10}: ZYMOMONAS MEDIUM}
\dummytable
\dummytext
\section*{\textbf{11}: MRS MEDIUM}
\dummytable
\dummytext
\section*{\textbf{11a}: MODIFIED MEDIUM 11}
\dummytext
\subsection*{Main sol. 11}
\dummytable
\dummytext
\section*{\textbf{11b}: MRS MEDIUM (pre-reduced)}
\dummytable
\dummytext
\section*{\textbf{12}: SOIL EXTRACT MEDIUM}
\dummytable
\dummytext
\end{document}
答案1
所提供的示例并未产生所示的空间,但确实在节标题后显示了错误的分页符。
理想情况下,可以修改表格宏以不允许在该点进行分页,但更简单的方法是使用包 needspace
来检查章节标题是否不会在页面上的位置太低。
\documentclass[10pt, a4paper, twocolumn]{book}
\usepackage{xtab,needspace}
\newcommand{\dummytable}{\par\nopagebreak
\begin{xtabular}{p{.35\textwidth}rl}
stuff like ingredients & 5 & g \\
stuff like ingredients & 3 & g \\
stuff like ingredients & 15 & g \\
stuff like ingredients & 1000 & g \\
stuff like ingredients & 3 & g \\
stuff like ingredients & 15 & g \\
stuff like ingredients & 1000 & g \\
\end{xtabular}%
}
\newcommand{\dummytext}{This is some dummy text to reproduce my problem.}
\begin{document}
\needspace{10\baselineskip}\section*{\textbf{1}: NUTRIENT AGAR}
\dummytable
\needspace{10\baselineskip}\section*{\textbf{1a}: REACTIVATION WITH LIQUID MEDIUM 1}
\dummytable
\dummytext
\needspace{10\baselineskip}\section*{\textbf{2}: BACILLUS PASTEURII MEDIUM}
\dummytable
\dummytext
\needspace{10\baselineskip}\subsection*{Main sol. 1}
\dummytable
\dummytext
\needspace{10\baselineskip}\section*{\textbf{3}: AZOTOBACTER MEDIUM}
\dummytable
\dummytext
\section*{\textbf{6}: A\needspace{10\baselineskip}LLANTOIN MINERAL MEDIUM}
\dummytable
\needspace{10\baselineskip}\section*{\textbf{7}: ANCYLOBACTER - SPIROSOMA MEDIUM}
\dummytable
\dummytext
\needspace{10\baselineskip}\section*{\textbf{8}: BACILLUS "RACEMILACTICUS" MEDIUM}
\dummytable
\dummytext
\needspace{10\baselineskip}\section*{\textbf{9}: VY/2 AGAR}
\dummytable
\dummytext
\needspace{10\baselineskip}\section*{\textbf{9a}: VY/2, REDUCED MEDIUM}
\dummytable
\dummytext
\needspace{10\baselineskip}\section*{\textbf{10}: ZYMOMONAS MEDIUM}
\dummytable
\dummytext
\needspace{10\baselineskip}\section*{\textbf{11}: MRS MEDIUM}
\dummytable
\dummytext
\needspace{10\baselineskip}\section*{\textbf{11a}: MODIFIED MEDIUM 11}
\dummytext
\needspace{10\baselineskip}\subsection*{Main sol. 11}
\dummytable
\dummytext
\needspace{10\baselineskip}\section*{\textbf{11b}: MRS MEDIUM (pre-reduced)}
\dummytable
\dummytext
\needspace{10\baselineskip}\section*{\textbf{12}: SOIL EXTRACT MEDIUM}
\dummytable
\dummytext
\end{document}