4

I have a bunch of graphics and text on pages that I would like to automatically center vertically. In some cases there is extra whitespace due to page breaks that leave a large amount of footer space that makes the page look top heavy. I do not want to manually add vertical space since the organization of graphics and text may change forcing me to update all the vfill's or vspace.

Is there a way to have tex this for me behind the scenes?

0

1 Answer 1

4

Yes, there is. You need to define \@texttop and \@textbottom. These are used in the LaTeX kernel output routine and can contain skip lengths.

\documentclass{article}
\usepackage{lipsum}
\usepackage{graphicx,alltt}
\makeatletter
\def\nobottom{%
\def\@texttop{\ifnum\c@page>0\vskip \z@ plus 3fil\relax\fi}
\def\@textbottom{\ifnum\c@page>0\vskip \z@ plus 2fil\relax\fi}}
\nobottom
\begin{document}
\pagestyle{headings}
\lipsum[1]
\clearpage
\lipsum[1-2]
\clearpage
\begin{alltt}
This can be a poem
     to see how it will
print
\end{alltt}
\end{document}

See Use of \@texttop and \@textbottom for vertical positioning for a more technical explanation.

2
  • how do I reset to the original though? Commented May 24, 2012 at 17:27
  • @AbstractDissonance Maybe write another macro \resetopandbottom which sets the values to the original LateX skips \vskip 0pt plus .00006fil.
    – yannisl
    Commented May 24, 2012 at 18:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .