[Tex/LaTex] How to center entire content of a page vertically

vertical alignment

I am using MacTex distribution of Tex, and using xetex for extended font support. My document class is 'article', and I am typesetting a booklet.

I can't seem to find solution on how to center a preface (consisting of multiple paragraphs on its own page) vertically within its page.

I have defined an environment to reuse preface formatting:

\newenvironment{preface}{\thispagestyle{empty}\topskip0pt\vspace*{\fill}\small}{\vspace*{\fill}}

As you can see, my prefaces (i am planning multiple booklets with same style) use smaller text, 'empty' page style and attempt to center vertically.

I have to say the above does attempt to center the content, but it is more top heavy than it should be. I want equal amount of space above the content and below it. How do I accomplish that, in the most straightforward way (if possible avoiding complex tex macros)?

Minimal working example:

\documentclass[a5paper]{article}
\newenvironment{preface}{\thispagestyle{empty}\topskip0pt\vspace*{\fill}\small}{\vspace*{\fill}}
\begin{preface}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed rhoncus eros et eros varius adipiscing. 

In fringilla, enim quis sagittis fringilla, lorem nulla aliquet purus, id malesuada elit mauris vitae nunc. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Integer ut fermentum sem. Maecenas dapibus elit sit amet laoreet pellentesque.

Integer nec euismod lectus, eget rutrum lacus. Suspendisse imperdiet auctor turpis. Integer congue condimentum nisl, eu ultrices felis facilisis ac. In hac habitasse platea dictumst. Nam at cursus eros, at posuere tellus. Vivamus ipsum nibh, pellentesque non lacinia nec, porta sed sapien. Suspendisse egestas velit ante, ut iaculis augue sollicitudin eget. 
\end{preface}
\end{document}

Best Answer

By default page margins at the top and bottom differ. You can use the geometry package, with its commands \newgeometry and \restoregeometry, to control the layout of this page. In particular setting vmargin together with ignoreheadfoot will give a vertically centered text block. However as Heiko Obertdiek points out there is still \topskip present and an initial inter line skip, so these need to be removed too:

Sample output

\documentclass[a4paper]{article}

\usepackage{lipsum}
\usepackage{geometry}
\newenvironment{preface}{\clearpage\setlength{\topskip}{0pt}%
  \newgeometry{vmargin=0cm,ignoreheadfoot}%
  \thispagestyle{empty}%
  \vspace*{\fill}\nointerlineskip\small}%
  {\vspace*{\fill}\clearpage\restoregeometry}

\begin{document}

\lipsum[1]

\begin{preface}
  \lipsum[2-6]
\end{preface}

\begin{preface}
  X\vrule height 295mm Y
\end{preface}

\lipsum[5]
\end{document}

Page 3 of this document is just for illustration. A4 paper is 297mm high. Page 3 has top

top of page 3

and bottom

bottom of page 3

demonstrating that our rule of 295mm is vertically centered.