146

How do I vertically center the text on a page?

54

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].

| improve this answer | |
  • 1
    This is great! I am using memoir, so I prefer this solution. – Neil G Aug 27 '10 at 7: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 tex.stackexchange.com/questions/7286/… – xport Dec 23 '10 at 2:30
  • 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
  • 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 2 '19 at 3:17
201

This is what I found:

\begin{document}
\topskip0pt
\vspace*{\fill}
text
\vspace*{\fill}
%
\end{document}
| improve this answer | |
  • 5
    Very useful for stuff that does not take the placement modifiers, like equations. thanks – rll Jan 8 '16 at 11:17
  • 5
    With this suggestion, I get a perfect vertically center text on a page, but I get several blank pages in other areas of the document. – Jh0an1 Uzca73gu1 Jan 21 '16 at 11:12
  • 3
    How do you solve the problem with extra blank pages like @Jh0an1Uzca73gu1 mentioned? – Daves Broadley Jan 21 '16 at 15:24
  • 2
    I use the following code, suggestion of other tex.stackexchange.com thread: \clearpage \vspace*{\fill} \begin{center} \begin{minipage}{\textwidth} \centering{This is some text to be centred vertically.} \end{minipage} \end{center} \vfill % equivalent to \vspace{\fill} \clearpage – Jh0an1 Uzca73gu1 Jan 22 '16 at 11:39
  • 1
29

This did the job for me:

\pagebreak
\hspace{0pt}
\vfill
Centered text.
\vfill
\hspace{0pt}
\pagebreak
| improve this answer | |
3

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.
| improve this answer | |
  • 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 1:36
2

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
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.