Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vertically centering a title page

I'm trying to vertically center a title on a custom-sized page with latex. I've written the following code, but for some reason it doesn't center. Could someone please point me to what's wrong with it?

Thanks!

\documentclass{article} \setlength{\pdfpagewidth}{88.184mm} \setlength{\pdfpageheight}{113.854mm}  \usepackage[margin=0.5cm, paperwidth=88.184mm, paperheight=113.854mm]{geometry}  \title{[[title]]} \date{[[date]]} \author{[[author]]}  \begin{document}     \vspace{\fill}     \maketitle     \vspace{\fill}      \newpage      [[text]] \end{document} 
like image 692
Clément Avatar asked Jun 29 '10 14:06

Clément


People also ask

How do you center a cover page vertically in Word?

in the Page Setup group, and then click the Layout tab. In the Vertical alignment box, click Center.

How do I center a document vertically?

1 Select the text you want to center between the top and bottom margins. 2 On the Page Layout tab, click the Page Setup Dialog Box Launcher. 3 Select the Layout tab. 4 In the Vertical alignment box, click Center 5 In the Apply to box, click Selected text, and then click OK.

How do I center my title page in LaTeX?

If you want to center some text just use \centering . If you want to align it differently you can use the environment \raggedleft for right-alignment and \raggedright for left-alignment.


1 Answers

There are two small bugs in your code.

First, if you want the \vspace to work at the beginning or end of a page, you should use the starred version (\vspace*).

This would work, but \maketitle is a pretty complicated macro, and if used like in your example, it just puts the title at the second page. You can use the titlepage environment, which gives you much more command over how the title page looks like -- including the spacing. For example, you could use the following code:

\documentclass{article} \setlength{\pdfpagewidth}{88.184mm} \setlength{\pdfpageheight}{113.854mm}  \usepackage[margin=0.5cm, paperwidth=88.184mm, paperheight=113.854mm]{geometry}  \begin{document}   \begin{titlepage}     \vspace*{\fill}     \begin{center}       {Huge [[title]]}\\[0.5cm]       {Large [[author}\\[0.4cm]       [[date]]     \end{center}     \vspace*{\fill}   \end{titlepage}    [[text]] \end{document} 
like image 113
finrod Avatar answered Sep 24 '22 20:09

finrod