I have very long tables that I'm generating the LaTeX for. In order to condense the number of pages, I'm spreading them out across multiple columns.

Curiously, xtabular matches the height of the table across the different pages. I would prefer if they filled up all available room on each page.

This behavior persists for both the multicol and multicol* environments.

Also, the first column on the first page stops short, but I'm less concerned with that.



% Allows xtabular to work in multicol environment
% Adapted from http://tex.stackexchange.com/a/46876/111714
      \hrule width\linewidth height0pt

% Repeats row n times (only for demo)
% Adapted from http://tex.stackexchange.com/a/62181/111714
2016-08-18 19:00:57&24.9\\


% Comment/Uncomment to see effect


    Time&Temp \\




Pages 1 and 2 without initial vspace

Pages 1 and 2 with initial vspace

(This pushed the document from 2 to 4 pages)


It is kind of surprising that it appears to work at all. But it exhibits so many issues that my conclusion is that xtab is hopeless (in this context and perhaps in general).

Turn on the option debugshow and you will see that

  • it reserves space for a caption that you don't have
  • it reserves much too much space for the head and tail
  • and it is overestimating the needed space line per line

The first two explain why your first "page" (ie multicol column) comes out so short. The last explains why all your columns appear so short.

Set \columnseprule=1pt to see where multicols thinks the columns are. A bit can be improved by setting \xentrystretch{-0.15} but clearly this isn't right (as it essentially say if X is a row height assume only 85% of that) so what needs to be done is to understand why xtab makes wrong assumptions (beside being cautious and enlarging everything by 10%)

The calculation for the head and tails come out absolutely wrong. It is done like this:


which is essentially putting the head into a tabular of its own and measuring that. Good idea but if the header is just \midrule (which is a point or so high) the above will generate nevertheless a full row height which is 12pt+

It gets a little better if you replace that by something like:


but this is not accounting for \arraystretch and there is more going on in the background so that result is still giving values at the high end.

There is the problem that a lot of space is reserved for a caption and even if it is not there something like 20pt are taken off and other strange bits in that part.

Finally as to why the \vspace has this strange effect:

  • the column height to shoot for is only calculated twice. Once before the first column is made and then again for the second column
  • the assumption is that the first column is "special" because it contains firsthead
  • that means all later columns get the same treatment as second

That is not even correct in two-column mode in std latex because a dangling figure* could get inserted later on if that table is really long and so the figure would shorten the second page (which means column 3 and 4).

But with multicols it fails more drastically as any material before the multicol shortens the space for the first x columns this from the xtab perspective for the first x pages, ergo all pages/columns.

In conclusion I think xtab shows a good number of issues that should show up in my opinion also when it is used without multicols in a good number of cases. Might be possible to fix all of them but it would be a more major undertaking.

  • Well, this appears to be simultaneously the most thorough and disheartening answer I could've hoped for. Thank you for the detailed reply. I noticed that you answered a closely related question before. Since I've had no luck with any of longtable, supertabular, and xtab inside of multicols, do you have any suggestions for creating the tables I'm trying to make? I'd be happy to make this its own post as you've already answered my original question. [edit: grammar] – hhquark Jan 8 '17 at 4:30
  • 1
    @hhquark the simle and probably again dishearting answer is that multicols was never written for that kind of scenario. table stuff like longtable or supertabular/xtab try to determine page breaks in the table (to add headers and footers etc, and multicols tries to find column breaks but for totally different reasons. So unless you really get a combined package where one knows about the other it is all somewhat shaky and will fail or be suboptimal in one or the other case. And that desn't exist unfortunately. – Frank Mittelbach Jan 8 '17 at 11:57

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.