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.

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?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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.

share|improve this answer
    
how do I reset to the original though? –  AbstractDissonance May 24 '12 at 17:27
    
@AbstractDissonance Maybe write another macro \resetopandbottom which sets the values to the original LateX skips \vskip 0pt plus .00006fil. –  Yiannis Lazarides May 24 '12 at 18:16
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.