3

I am using the xtab package to add a long table in a business report. A premature page break is added at each page, leaving a large bottom margin. Same problem occurs with package supertabular (on which xtab is based). Any ideas?

Related: Long tables (spanning multiple pages), put side by side

I put a sample below:

\documentclass[11pt]{article}
\usepackage{xtab}
\begin{document}
\begin{xtabular}{|l|l|}
a & 0 \\
a & 1 \\
a & 2 \\
a & 3 \\
a & 4 \\
a & 5 \\
a & 6 \\
a & 7 \\
a & 8 \\
a & 9 \\
a & 0 \\
a & 1 \\
a & 2 \\
a & 3 \\
a & 4 \\
a & 5 \\
a & 6 \\
a & 7 \\
a & 8 \\
a & 9 \\
a & 0 \\
a & 1 \\
a & 2 \\
a & 3 \\
a & 4 \\
a & 5 \\
a & 6 \\
a & 7 \\
a & 8 \\
a & 9 \\
a & 0 \\
a & 1 \\
a & 2 \\
a & 3 \\
a & 4 \\
a & 5 \\
a & 6 \\
a & 7 \\
a & 8 \\
a & 9 \\
a & 0 \\
a & 1 \\
a & 2 \\
a & 3 \\
a & 4 \\
a & 5 \\
a & 6 \\
a & 7 \\
a & 8 \\
a & 9 \\
a & 0 \\
a & 1 \\
a & 2 \\
a & 3 \\
a & 4 \\
a & 5 \\
a & 6 \\
a & 7 \\
a & 8 \\
a & 9 \\
a & 0 \\
a & 1 \\
a & 2 \\
a & 3 \\
a & 4 \\
a & 5 \\
a & 6 \\
a & 7 \\
a & 8 \\
a & 9 \\
a & 0 \\
a & 1 \\
a & 2 \\
a & 3 \\
a & 4 \\
a & 5 \\
a & 6 \\
a & 7 \\
a & 8 \\
a & 9 \\
\end{xtabular}
\end{document}

Just for reference:

The best result that I could get, is by using the following:

  • The "nofoot" option of the geometry package.

  • The xtab package for the table

  • The xentrystretch{0} command of the xtab package.

  • 1
    The supertabular package makes some (bad) assumptions about the space to reserve for rows and it adds a rather large overshoot. This doesn't happen with longtable. – egreg Sep 25 '15 at 07:41
  • related: http://tex.stackexchange.com/questions/267109/longtable-appears-to-prevent-enlargethispage-from-working/ – touhami Sep 25 '15 at 07:57
  • @egreg I cannot use longtable, because I need to put two long tables in two parallely constructed columns, using the paracol package. – Aggelos Chariatis Sep 25 '15 at 09:41

2 Answers2

2

I added \shrinkheight{-2in} in two different places and the 3-page sample was reduced to two pages. Check this out:

\documentclass[11pt]{article}
\usepackage{xtab}
\begin{document}
\begin{xtabular}{|l|l|}
\shrinkheight{-2in}
a & 0 \\
a & 1 \\
a & 2 \\
a & 3 \\
a & 4 \\
a & 5 \\
a & 6 \\
a & 7 \\
a & 8 \\
a & 9 \\
a & 0 \\
a & 1 \\
a & 2 \\
a & 3 \\
a & 4 \\
a & 5 \\
a & 6 \\
a & 7 \\
a & 8 \\
a & 9 \\
a & 0 \\
a & 1 \\
a & 2 \\
a & 3 \\
a & 4 \\
a & 5 \\
a & 6 \\
a & 7 \\
a & 8 \\
a & 9 \\
a & 0 \\
a & 1 \\
a & 2 \\
a & 3 \\
a & 4 \\
a & 5 \\
a & 6 \\
a & 7 \\
a & 8 \\
a & 9 \\
a & 0 \\
a & 1 \\
\shrinkheight{-2in}
a & 2 \\
a & 3 \\
a & 4 \\
a & 5 \\
a & 6 \\
a & 7 \\
a & 8 \\
a & 9 \\
a & 0 \\
a & 1 \\
a & 2 \\
a & 3 \\
a & 4 \\
a & 5 \\
a & 6 \\
a & 7 \\
a & 8 \\
a & 9 \\
a & 0 \\
a & 1 \\
a & 2 \\
a & 3 \\
a & 4 \\
a & 5 \\
a & 6 \\
a & 7 \\
a & 8 \\
a & 9 \\
a & 0 \\
a & 1 \\
a & 2 \\
a & 3 \\
a & 4 \\
a & 5 \\
a & 6 \\
a & 7 \\
a & 8 \\
a & 9 \\
\end{xtabular}
\end{document}
qzx
  • 550
  • 3
  • 13
  • The report will created programmatically without the possibility of making manual adjustments. – Aggelos Chariatis Oct 09 '15 at 12:09
  • Just for reference: The best result that I could get, is by using the following:
    • The "nofoot" option of the geometry package.
    • The xtab package for the table
    • The xentrystretch{0} command of the xtab package.
    – Aggelos Chariatis Oct 09 '15 at 12:12
1

The package supertabular overestimates row heights in order to be sure to split the table before the page break.

Here's a proof:

\documentclass[11pt]{article}
\usepackage{showframe}
\usepackage{xtab}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\estimate@lineht}{1\p@}{-1.5\p@}{}{}
\makeatother
\begin{document}
\begin{xtabular}{|l|l|}
a & 0 \\
a & 1 \\
a & 2 \\
a & 3 \\
[...]
\end{xtabular}
\end{document}

(fill in the data). You'll see that the chunks end almost at the page break.

enter image description here

egreg
  • 1,121,712