1

For my current project I need multiple tables with 2 columns that span over multiple pages, and all in twocolumn mode! Supertabular should be the right choice for this, if I'm not wrong.

The problem is, I often get unwanted pagebreaks, in places where it's totally unnecessary.

MWE (2 LaTeX runs):

\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}

enter image description here

For example, here on p. 4, the whole next table is moved to the next page column. I get following log for the problematic table:

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

There has to be some bad calculation...


All in all: There's so much waste of space and that's just unacceptable :-(

If there is an alternative package to do this better, let me know.

EDIT: I wrote my own solution here.

musicman
  • 3,559
  • It would be helpful to know your desired output. But do you want something like this (PDF download)? – Alenanno Jun 23 '15 at 16:55
  • Yes. If you run my MWE you see the wanted layout. I just want to decrease the waste of space from the pagebreaks (or the not happening pagebreaks) – musicman Jun 23 '15 at 17:02
  • Did you manage to see the PDF? No registration is required. When the pop-up comes up, you can press Esc or click anywhere on the page and it goes away. Anyway, try replacing the line with begin{supertabular} with the following: \begin{supertabular}{p{.05\textwidth}@{\hspace{2mm}}|@{\hspace{2mm}}p{.38\textwidth}}. Let me know if it works your way. – Alenanno Jun 23 '15 at 17:15
  • That does not work. How should slightly different widths solve the problem? Looks better on the first page, but the problems still appear in the following pages – musicman Jun 23 '15 at 19:30
  • Well, it helps a bit and especially if you want to change margins. You're using absolute widths right now, so if you change margins, everything will break. But like I said, it'd be helpful to know what you actually need to do and post an actual example. For instance: is the Col A always going to be just numbers? – Alenanno Jun 23 '15 at 19:49
  • No sorry, it sadly doesn't help. Your document shows similar errors, see page 4 of your document. I've updated my question. it's not about the layout. I think supertabular is somehow calculating the space wrong. – musicman Jun 24 '15 at 10:38
  • Why do you think it is miscalculating? If finds that the tabular would exceed the available height - not by much, but by something. So it moves it to the next page (column). That may be undesirable but I don't see why it would be supertabular's fault. – cfr Jun 25 '15 at 03:44

0 Answers0