207

How do I vertically center the text on a page?

doncherry
  • 54,637
Neil G
  • 17,947

5 Answers5

276

This is what I found:

\begin{document}
\topskip0pt
\vspace*{\fill}
text
\vspace*{\fill}
%
\end{document}
Neil G
  • 17,947
67

The memoir document class provides, among a lot of other excellent things, the vplace environment.

Try:

\documentclass{memoir}
\begin{document}
\begin{vplace}[0.7]
This is some text to be centered vertically.
\end{vplace}
\end{document}

[0.7] is an optional parameter specifying the ratio of space above to space below. The default value is [1].

  • 1
    This is great! I am using memoir, so I prefer this solution. – Neil G Aug 27 '10 at 07:05
  • 4
    Fantastic! I think we ought to start a memoir fanclub... – Brent.Longborough Aug 27 '10 at 11:49
  • 3
    I haven't tried your code above. But I am not sure your code will produce an exact vertically-centered object since I notice your code does not specify \topskip0pt right before \begin{vplace}[1]. For more details, see http://tex.stackexchange.com/questions/7286/how-to-make-an-exact-vertically-centered-object-in-a-page – Display Name Dec 23 '10 at 02:30
  • 1
    @JoeCorneli Thanks for your suggested edit. I've left the brackets, simply to emphasise that it's an optional parameter, and reworded to clarify the rest. – Brent.Longborough Mar 07 '13 at 09:52
  • 2
    Perhaps the anonymous down-voter would care to share his/her reasons here, so that I, and others, can learn and improve? – Brent.Longborough Oct 19 '14 at 12:37
  • 1
    I can't' install the memoir package. @NeilG 's option works best. – KeyC0de Jul 10 '18 at 12:26
  • 2
    @Nikos That's because it isn't a package but a documentclass type. So instead of \documentclass{article} you can use documentclass{memoir}. – jackw11111 Jun 02 '19 at 03:17
  • 2
    This isn't quite a solution to the original question, since it requires the user to change their documentclass. There are many other document classes, and good reasons for users to use them. Therefore, a solution that works over a broad range of document classes is more appropriate, unless the question specifically asks to use this class, or specifically states that the document class is not constrained. – MRule Jan 15 '22 at 16:50
  • @MRule There is no perfect solution to this question. If you're using memoir, this answer is probably the best solution. If you're not using memoir, one of the other answers is more appropriate. – Neil G Jun 24 '23 at 18:00
63

This did the job for me:

\pagebreak
\hspace{0pt}
\vfill
Centered text.
\vfill
\hspace{0pt}
\pagebreak
4

In ConTeXt MkIV you use standardmakeup. For horizontal centering add the additional key align=middle as in the example below.

\starttext
\startstandardmakeup[align=middle]
  Centered text!
\stopstandardmakeup
\stoptext
Henri Menke
  • 109,596
1

Very simple way, like described here.

Text at the top of the page.

\vspace{5mm} %5mm vertical space

This text still at the top, 5mm below the first paragraph.

\vspace{25mm} %25mm vertical space

This text is somewhere in the middle.

\vfill

Text at the bottom of the page.
Sim Son
  • 264
  • 1
    you should provide an example of document (regardless that op didn't) which show vertical centering of text on page. – Zarko Feb 22 '18 at 01:36