O'Reilly logo

LaTeX Beginners Guide by Stefan Kottwitz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – centering a title

We shall create a nice looking title for our document. It should contain the title, the author, and the date. All those lines have to be centered.

  1. Write a document containing this code:
    \documentclass{article}
    \pagestyle{empty}
    \begin{document}
    {\centering
        \huge\bfseries Centered text \\
        \Large\normalfont written by me \\
        \normalsize\today
    
    }
    \end{document}
  2. Typeset to see the output:
    Time for action – centering a title

What just happened?

Because only the title should be centered, we opened a group to limit the centering. Through the declaration \centering , we made the remaining text of this group horizontally aligned to the center. We inserted a paragraph ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required