GeneralVertical text justification

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
trunto
Posts: 1
Joined: Sat Oct 25, 2008 4:00 pm

Vertical text justification

Post by trunto »

I want to vertically justify ie. center the text ("\huge Footitle") with the following code:

Code: Select all

\begin{titlepage}
\vfill
\begin{center}
\huge Footitle
\end{center}
\vfill
\end{titlepage}
But it doesn't work as it should. But if I add a line of text before the first \vfill it works:

Code: Select all

\begin{titlepage}
somerandometext
\vfill
\begin{center}
\huge Footitle
\end{center}
\vfill
\end{titlepage}
What is the proper way to vertically align text in LaTeX?

Thank you for your answers...

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Vertical text justification

Post by localghost »

You can insert an invisible character.

Code: Select all

\begin{titlepage}
  \centering
  ~
  \vfill
  \huge Footitle
  \vfill
\end{titlepage}

Best regards and welcome to the board
Thorsten¹
User avatar
Stefan Kottwitz
Site Admin
Posts: 10347
Joined: Mon Mar 10, 2008 9:44 pm

Vertical text justification

Post by Stefan Kottwitz »

Hi Trunto,

welcome to the board!
Use

Code: Select all

\vspace*{\fill}
instead of \vfill. Vertical space by \vfill (and \vspace) would be removed at the beginning or the end of the page, but not in the case of \vspace*.

Stefan
LaTeX.org admin
Post Reply