Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In the following document:

\documentclass[twocolumn]{article}
\begin{document}

\begin{tabular*}{\linewidth}{|c|}\hline test\\\hline\end{tabular*}

\vfill

\begin{tabular*}{\linewidth}{|c|}\hline test\\\hline\end{tabular*}

\pagebreak

\begin{tabular*}{\linewidth}{|c|}\hline test\\\hline\end{tabular*}

\vfill

\begin{tabular*}{\linewidth}{|c|}\hline test\\\hline\end{tabular*}

\end{document}

I'd like the second and fourth tabulars to be lined up, however the fourth one is placed a little higher, as if LaTeX inserts some space after it. If I put some text instead of the tabulars, it lines up perfectly. How can I make it work with tabulars?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

You can use \newpage instead of \pagebreak: This also makes the lower left tabular move up, so that you have your desired alignment. Usually \newpage is not recommended, but as you have some \vfill in between, this is no problem here.

EDIT:

Here's a partial explanation of what happens. Your tabular produces an hbox with a depth of 3.9pt. This is the 3.9pt that also TH talked about. Now suppose you have a bottom margin of 1cm. Then it is not the very bottom of the text that is 1cm from the bottom of the page, but the baseline of the last hbox of the page/column. Thus, if the last line has decenders, such as the letter "j" has, then the descenders will be a little closer to the bottom of the page than you might expect. This is intended design since it makes the baselines of the last lines of the pages align.

In your case, the lower horizontal line of the tabular is the "descender", as far as I understand, and it descends 3.9pt as mentioned above. Now the article class with 10pt fontsize defines a maxdepth of 5pt, which essentially means that you can't get more than 5pt closer than expected to the bottom of the page. The 3.9pt of the tabular are less than 5pt, so this will be accepted.

Now you'll ask: Why doesn't the same thing apply to the second column? This I can't fully explain, but I can describe what happens. The \end{document} at the end calls the macro \clearpage, which in turn calls \newpage. This is the reason why you get the desired alignment if you use \newpage instead of \pagebreak as I propose above: For both columns you then have the same macro ending the column.

And why does \newpage prevent the 3.9pt "descender"? The \newpage macro adds a \vfil before the \penalty-10000 that causes the pagebreak, this \vfil gives another permissible breakpoint, and here you don't have any descenders. Finally, \vfil is an infinitely stretchable glue, but it's infinitely weaker than \vfill, so it doesn't prevent the last tabular from moving to the bottom of the text. Just try it yourself and replace both occurences of \vfill in the document with \vfil!

share|improve this answer
    
Thanks for the great explanation. –  Rodrigo Tjäder Oct 20 '10 at 15:29
add comment

This isn't very satisfying. I'm not sure why this happens. If you add a \pagebreak after the last tabular, they line up. There is something about \penalty-10000 (which is basically what \pagebreak does) that causes it to work as you think it should.

If you look at the boxes that result from the page builder, the left column has an additional glue of -3.9 pt which is what is causing it to be lower. I'm not sure where that is coming from exactly (although I'm sure someone can explain it).

Here's an experiment you can try to see this yourself. Add \nointerlineskip\null after the second tabular with no other changes. This causes the tabular to move up (it gets rid of the -3.9 pt of glue). Now, add \pagebreak after the fourth tabular and notice how the left column is now the one that is 3.9 points too high.

share|improve this answer
    
Thanks, that allows me to do what I want. My guess is that the left column is too low, as after setting margins to 1cm with geometry it seems to be closer than that to the margin. (I may be wrong, I'm comparing it with the top margin without printing.) Now lets wait until someone with more experience explains what causes this behavior. –  Rodrigo Tjäder Oct 18 '10 at 17:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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