[Tex/LaTex] Force vertical white space at top and bottom of page to be _exactly_ the same

vertical alignment

I am trying to get exact symmetry of leading and trailing vertical white space.

I have a sample 1-page document with a top line containing the dummy text "ABCDE", some dummy vertical space, and a bottom line, also containing the text "ABCDE". My page size is 8.5in by 11in.

The goal is to get the distance from the absolute top of the page to the top of the letter A in the first line to be exactly same as the distance from the absolute bottom of the page to the base of the letter A on the last line.

I tried the following:

\documentclass{article}
\pagenumbering{gobble}
\begin{document}
\topskip=0pt
\vspace*{\fill}
ABCDE
\par
\vspace{7in}
\par
ABCDE
\vspace*{\fill}
\end{document}

but it doesn't quite work.

I want the solution to automatically work for all pages, each with their own amounts of leading and trailing vertical white space. For example, one page may need 4in of leading and trailing space which I want to split as exactly 2in at the top, and 2in at the bottom, and some other page may need only 1.5in of vertical space which I want to split as exactly .75in at the top, and .75in at the bottom.

How can I do this? Thanks in advance.

Best Answer

You can use the geometry package to set the margins symmetrically. If you don't want any margins at all:

\documentclass{article}
\pagenumbering{gobble}

\usepackage[ 
    %showframe, 
    top=0pt, 
    bottom=0pt,
    paperwidth=8.5in,
    paperheight=11in,
]{geometry}

\begin{document}
\topskip=0pt
\vspace*{\fill}
ABCDE
\par
\vspace{10.5in}
\par
ABCDE
\vspace*{\fill}
\end{document}

This package can also be used to set the paper size.

Related Question