# How to vertically center a piece of text on a page?

I've been searching how to center a piece of text vertically on a page, since I wanted to create a cover for my reports with the Title centered both vertically and horizontally. I first tried the following code:

\vfil
\centerline{Title}
\vfil

\eject\end


But this isn't centered vertically. So I found this answer, and so I added \leavevmode to the beginning of the file. And it worked! I also tried putting instead \indentat the beginning of the original. And it also worked!

So my question is: Why do you need to start a paragraph or "leave vertical mode" before the first \vfil in order for the glue to work in centering the text veertically on the page? It all seems very odd, indeed.

• Because glue is discardable at a page break. p112 of The TeXBook explains the mechanism. – Thruston Jan 21 '19 at 17:28
• You can also use \null or \hbox{} or... many other options. The reason/idea of discarding glue at the top of a page is similar to discarding glue at the start of a line: after a line/page break, you don't want “leftover” glue from the previous line/page to affect the current one. – ShreevatsaR Jan 21 '19 at 18:46
• @JohnKormylo -- This question is about plain tex. \vspace is latex only. – barbara beeton Apr 10 '19 at 1:07

As mentioned in the comments \TeX ignores glue at the end or top of a page as it does ignore glue at the end or start of a line.

But plain \TeX knows some commands for glue that does not vanish; you do not need to enter a special command like \leavevmode. For glue at the top of a page \topglue is used instead of \topskip. (And there is \hglue and \vglue as non-discarding variants of \hskip and \vskip.)

For your problem this \topglue provides a solution. As \bye contains \vfill, i.e., glue with specification 0pt plus 1fill, input

\topglue 0pt plus 1fill
\centerline{Titel}
\bye