13

I would like to vertically center my title page. I have tried code like this, but it does not work:

\vfill
\startalignment[center]
    Title
\stopalignment
\vfill
  • I am using ConTeXt, so the solutions at Vertically center text on a page did not work, however, solutions in plain TeX will be fine too.
  • The documentation on \setupalign at the ConTeXt wiki suggests there might be the option lohi, but it seems only to center content vertically when placed inside a frame.

How can I vertically center content on a page?

Village
  • 13,603
  • 23
  • 116
  • 219

2 Answers2

16

As Aditya already answered, the most common way is to use \startstandardmakeup, as in:

\starttext
\startstandardmakeup
\startalignment[center] % or \centerline{...}
    {\definedfont[Bold at 40pt] Title}
\stopalignment
\stopstandardmakeup
document text
\stoptext
  • 2
    Don't use explicit align macros. You can use: \setupmakeup[align=middle]. – Aditya May 07 '12 at 01:06
  • @Aditya Could you explain why not to use explicit align macros? I am an absolute ConTeXt beginner. – Serge Stroobandt Sep 01 '13 at 18:31
  • 2
    @SergeStroobandt: Because it is bad style. I will prefer using \starttitlepagemakeup Title \stoptitlepagemakeup rather than what is described in the solution (where titlepage makeup is appropriately defined). – Aditya Sep 01 '13 at 18:44
  • @SergeStroobandt: To give an analogy, it will be a bad style in LaTeX to use \section{\itseries First section}. It is better to move the formatting setup in the preamble and use semantic markup in the document body. – Aditya Sep 01 '13 at 18:46
  • this only horizontally centers my text :c – xeruf Aug 29 '22 at 18:49
0

Maybe it's a hack, but in my code this always works: place a \phantom{x} before the \vfill to get the desired effect.

  • 1
    This is a brutal hack! (1) You shouldn't do this, (2) if you decide to to this use at least \leavevmode\vfill instead of \phantom{x}\vfill. – Henri Menke Aug 05 '16 at 07:34
  • @HenriMenke, I know it's quite an old answer (and comment), I'm wondering why one option is preferable to the other. –  Jan 21 '19 at 17:21