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 settingvmargin
together withignoreheadfoot
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:Page 3 of this document is just for illustration. A4 paper is
297mm
high. Page 3 has topand bottom
demonstrating that our rule of
295mm
is vertically centered.