# How can I make vfill to work without adding any text before?

Using \vfill between two texts works:

\newpage
bla
\vfill
blabla


but it doesn't work if there is no text before it:

\newpage
\vfill
blabla


How can this be achieved?

-

Adding an empty box like \mbox{} or \hbox{} (or \null for short) before the \vfill makes it work.

\newpage
\null
\vfill
blabla

-
remember that any box will add a blank line, so if the exact height of the fill is important, that must be taken into consideration. a plain-tex alternative to a box is \hrule height0pt depth0pt width1pc; this puts something "solid" in place to anchor the \vfill but doesn't take up any measurable vertical space. – barbara beeton Jun 23 '11 at 12:41
@barbara: Thanks, I actually thought about the introduced height while writing the post and thought to maybe replace \null with \vspace*{0pt}, but didn't wanted to mention it without testing it. Personally I actually like Andrew's suggestion to use \vspace*{\fill} better than my answer. – Martin Scharrer Jun 23 '11 at 12:52
\hbox{} \null \vfill did the job for me. Thanks. – Ivo Aug 31 '14 at 17:38
@Ivo: \null is the same as \hbox{}, so one of the two is sufficient. – Martin Scharrer Sep 1 '14 at 16:06
@MartinScharrer: I've tried all combinations, but for some reason it only worked with both. Maybe there's something wrong with my template - I don't know... – Ivo Sep 1 '14 at 20:06

It's important to understand how TeX's page break mechanism works, at least for the main aspects.

When TeX decides where to break a page, it pushes back to the "list of recent contributions" what doesn't fit in the page and does the break.

Usually what doesn't fit are the final lines of a paragraph, but a break can very well happen at a vertical space (such breaks happen always before the vertical space). Now the break is performed and the vertical space is put back to be reconsidered; but nobody wants to start a normal page with a vertical space, so TeX makes it disappear.

This unless this vertical space is declared with \vspace*: this kind of vertical space is never considered for a break, it's just like a big invisibile character.

How the page break was chosen is irrelevant: this happens even at the start of a document. If you say

\begin{document}
\vspace{3cm}


this vertical space will not appear.

Using \null after \newpage effectively avoids the disappearance of vertical spaces, because \null puts on the page an empty box before the \vspace (something like a zero width and height character).

Thus the "good" way to build a dedication page, for instance, is

\cleardoublepage
\thispagestyle{empty}
\vspace*{\stretch{1}}
\begin{flushleft}
\itshape Dedicated to the people on \TeX.SX\\
on the occasion of the first birthday\\
of that wonderful site
\end{flushleft}
\vspace{\stretch{2}}
\cleardoublepage


The \vspace*{\stretch{1}} is actually equivalent to \null\vfill; but specifying the stretching with \stretch allows for nice effects: here the white space after the dedication is twice as much as the space before it.

-

LaTeX provides the macro \vspace for adding an amount of space, \vspace{\fill} has the same effect as \vfill, and has the same failing. LaTeX also provides1 the macro \vspace* for "I really, really do want you to put the space in here." so \vspace*{\fill} works. That is to say,

\newpage
\vspace*{\fill}%
blabla


puts the blabla at the bottom.

1 Actually, \vspace and \vspace* are the same macro, but it's a convenient lie to think of them as variant macros.

-