0

Background information

I am creating a book with thousands of recipes in a two-column layout. The tables with the ingredients can be short, but can also be fairly long, so I like the tables to break.

The problem

When a column starts with a chapter/section/subsection header, it induces a columnbreak, leaving large parts of the page empty.

enter image description here

What I tried so far

The usual, I tried different document classes, e.g. scrbook, article. I tried using different packages and their respective environments, such as supertabular and xtab. Longtable is not working in two-column layout. I also tried different compilers, i.e. XeLaTeX (which I commonly use) and pdfLaTeX. I also removed every styling, makros (added some again for the mwe), and fonts. Nothing worked so far.

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
  • You may also try longtblr environment from tabularray package.
    – L.J.R.
    Feb 4, 2022 at 9:47

1 Answer 1

0

The provided example didn't produce the space shown but it did show a bad page break after a section heading.

Ideally one woul modify the table macros not to allow a page break at that point but simpler is to use the needspace package to check that section headings do not fall too low on the page.

enter image description here

\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}
4
  • Thanks a lot for your efford! As I indicated in my question, the MWE did produce the result shown on the image. However, when I run the compilation multiple times, I get the column break on different positions and sometime even none. The longer the document, the higher the possibility that column breaks occur. The original doc contains >700 pages and a large number of unwanted breaks. needspace does not fix this.
    – JKoblitz
    Feb 4, 2022 at 9:04
  • @JKoblitz no that MWE doesn't have different page breaks on different runs, were you trying a version with \tableofcontents that would change after the first run. Feb 4, 2022 at 9:05
  • I updated the MWE to be more reproducible. I also added an updated image of the result after three compilation runs. No tableofcontents. It is the exact same code that I posted above.
    – JKoblitz
    Feb 4, 2022 at 9:14
  • @JKoblitz thanks. Feb 4, 2022 at 9:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .