[OS X TeX] Vertical center text alignment

Bruno Voisin bvoisin at mac.com
Tue Nov 29 12:04:57 CET 2005


Le 29 nov. 05 à 06:32, Morten Høgholm a écrit :

> On Tue, 29 Nov 2005 02:01:11 +0100, Herbert Schulz  
> <herbs at wideopenwest.com> wrote:
>
>> \documentclass{article}
>> \title{Put the Title Here}
>> \date{}
>> \pagestyle{empty}
>> \begin{document}
>> \maketitle
>> \thispagestyle{empty}
>> % here's the page
>> \pagebreak
>
> Use \newpage if you know you want a new page. \pagebreak is for  
> encouraging LaTeX to break it there and can lead to warnings.
>
>> \mbox{}% to get into horizontal mode
>> \vfill
>
> \vspace*{\fill} also works.

I some circumstances, when writing a custom letter class, I've found  
\vspace*{\fill} at the top of a page doesn't always work, and I tend  
to use plain TeX's \null or \leavevmode instead, followed by \vfill.  
For example:

\null
\vspace{-\baselineskip}\vspace{-\parskip}
\vspace{-\headheight}\vspace{-\headsep}
\vfill

so that all space for heading, and all reserved space for the first  
line on the page, is discarded before entering the infinitely  
stretchable glue then the text to be vertically centered.

Bruno Voisin------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the macostex-archives mailing list