1

In this MWE, supertabular breaks the page (or column, if one is using twocolumn) early. In fact, the first page holds only 5 lines, while the second holds 7.

\documentclass[twocolumn]{article}
\usepackage[paperheight=2in]{geometry}
\usepackage{supertabular}
\begin{document}
\begin{supertabular}{p{3mm}}
    1\\ 2(  3\\ 4(  5\\
    1\\ 2\\ 3\\ 4\\ 5\\ 6\\ 7\\
\end{supertabular}
\end{document}

enter image description here

I thought his may have something to do with the presence of the parentheses, but I can reproduce a less severe issue (6 lines vs. 7) without them as well:

\documentclass[twocolumn]{article}
\usepackage[paperheight=2in]{geometry}
\usepackage{supertabular}
\begin{document}
\begin{supertabular}{p{1.7mm}}
    1   2\\ 3   4\\ 5   6\\
    1\\ 2\\ 3\\ 4\\ 5\\ 6\\ 7\\
\end{supertabular}
\end{document}

enter image description here

In my document, I can even reproduce the issue without any parentheses or line breaks in cells. That is a bit harder to reproduce as an MWE, however.

I have tried the approach described in Prevent xtab breaking table too soon and Prevent supertabular* from breaking too early without success.

Edit: Here's another example not involving line breaks in cells, but a line break in the \tablehead:

\documentclass[twocolumn]{article}
\usepackage{lipsum}
\usepackage{supertabular}
\def\heads{Head Head Head Head Head Head }
\edef\mycont{\heads\heads\heads\heads\heads\heads\heads}
\tablehead{\multicolumn{1}{p{\dimexpr \columnwidth - 12pt}}{\mycont}\\}
\begin{document}
\lipsum[1-2]

\begin{supertabular}{p{1cm}}
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
\end{supertabular}
\end{document}

enter image description here

Here's one using \tablefirsthead (in this case, it seems the second column is long, rather than the first too short - but they should have the same length anywy, and I don't get a box warning, either):

\documentclass[twocolumn]{article}
\usepackage{supertabular}
\tablefirsthead{}
\tablehead{Continued\\}
\begin{document}
\begin{supertabular}{p{1cm}}
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
\end{supertabular}
\end{document}

enter image description here

And here's one using \tablecaption:

\documentclass[twocolumn]{article}
\usepackage{supertabular}
\tablecaption{Caption}
\begin{document}
\begin{supertabular}{p{1cm}}
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
\end{supertabular}
\end{document}

enter image description here

Edit 2: I also found Too large bottom margin with xtab (or supertabular) and Long tables (spanning multiple pages), put side by side and tried their solutions.

I need twocolumn, so longtable won't work; and the best solution for the first link is even worse:

\documentclass[twocolumn]{article}
\usepackage{lipsum}
\usepackage{xtab}
\usepackage[nofoot]{geometry}
\tablefirsthead{}
\tablehead{H\\}
\begin{document}
\begin{xtabular}{p{1cm}}
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
\end{xtabular}
\end{document}

enter image description here

I think my summary question is: is this fixable at all, or should I refrain from using supertabular/xtab if I want my tables to break correctly?

2
  • TeX.SE must be broken. I asked this 9 hours ago, and there's not even a comment. I cannot remember this ever happening.
    – bers
    Jan 26, 2021 at 19:12
  • 1
    supertabular decides to issue a page break based on a very disputable heuristic for evaluating the space taken so far. Possibly xtab is better, but I'm not sure.
    – egreg
    Jan 28, 2021 at 10:02

1 Answer 1

2

I got slightly better results by removing the wrong heuristic used by supertabular that adds 1pt for every line.

Of course this is not a magic wand that will work in every case.

\documentclass[twocolumn]{article}
\usepackage{lipsum}
\usepackage{supertabular}
\usepackage{showframe}

% https://www.guitex.org/home/forum/5-tex-e-latex/26889-supertabular-e-twocolumn-riempimento-parziale-altezza-testo?lang=it#26893
\makeatletter
\def\mod@estimate@lineht{% 
  \ST@lineht=\arraystretch \baslineskp
  %\global\advance\ST@lineht by 1\p@ 
  \ST@stretchht\ST@lineht\advance\ST@stretchht-\baslineskp
  \ifdim\ST@stretchht<\z@\ST@stretchht\z@\fi
  \ST@trace\tw@{Average line height: \the\ST@lineht}% 
  \ST@trace\tw@{Stretched line height: \the\ST@stretchht}% 
}
\newenvironment{strictsupertabular}
  {\let\estimate@lineht\mod@estimate@lineht\supertabular}
  {\endsupertabular}
\makeatother

\begin{document}

\tablefirsthead{}
\tablehead{H\\}
\begin{strictsupertabular}{p{1cm}}
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
    1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\
\end{strictsupertabular}
\end{document}
7
  • I do not see any difference between supertabular and strictsupertabular in this example.
    – bers
    Jan 29, 2021 at 9:52
  • @bers Don't you? I sure do.
    – egreg
    Jan 29, 2021 at 9:57
  • I really don't. The left column breaks after 34 numbers ending in "4", the right column has 35 numbers ending in "8", in both cases, on TeX Live 2020 on Linux and MiKTeX on Windows.
    – bers
    Jan 29, 2021 at 10:13
  • @bers That's much better than what you get from supertabular, isn't it? You can't obtain equalized columns automatically with supertabular. That's the problem.
    – egreg
    Jan 29, 2021 at 10:17
  • I get the exact same result for supertabular.
    – bers
    Jan 29, 2021 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.