Centrer Le Titre De La Page De Garde Latex

Alright, mes amis! Gather 'round, I've got a tale for you. A tale of woe, of frustration, and ultimately, triumph! It's a story about...centring the title on a LaTeX title page. Yes, I know, sounds thrilling, right? Like a summer blockbuster starring a semicolon and a misplaced bracket. But trust me, there's drama!

So, picture this: you've spent days, nay, weeks, crafting the perfect document. Your introduction is so captivating, it could sell ice to Eskimos. Your methodology is so rigorous, it'd make Einstein proud. But then… the title page. The first impression. And the title is stubbornly hugging the left margin like it's afraid of missing the bus. Sacrebleu!

The Usual Suspects (and Their Lack of Cooperation)

First, you try the obvious. You throw in a `\begin{center}` environment. Simple, right? Wrong! LaTeX, in its infinite wisdom, decides that "center" is just a suggestion. Your title might shift a millimetre, but essentially, it's still playing hard to get. It's like asking your cat to do a trick. You might get lucky, but chances are you'll just get a judging stare.

Then comes the frantic Googling. You stumble upon forums filled with LaTeX wizards muttering incantations like `\hfill`, `\vfill`, and `\vspace`. You copy and paste these magical phrases, hoping for a miracle. But alas, your title remains off-center, now perhaps in a slightly different off-center position. Congratulations, you've successfully relocated the problem!

The Solution (Finally!)

Okay, enough teasing. Here's the secret, the pièce de résistance: the `titling` package. I know, I know, another package. But trust me, this one's a game-changer.

Page De Garde Originale Avec Latex - vrogue.co
Page De Garde Originale Avec Latex - vrogue.co
  • First, you need to add \usepackage{titling} to your preamble (that magical section at the beginning of your LaTeX document where you declare all your cool superpowers...I mean, packages).
  • Then, you can use the following code snippet before your `\maketitle` command:
          \begin{verbatim}
          \pretitle{\begin{center}\LARGE}
          \posttitle{\par\end{center}\vspace{1em}}
          \preauthor{\begin{center}\large}
          \postauthor{\par\end{center}\vspace{0.5em}}
          \predate{\begin{center}\large}
          \postdate{\par\end{center}}
          \end{verbatim}
          

This little chunk of code essentially tells LaTeX: "Hey, before you put the title, author, and date, CENTER THEM! And after, too!" It's like politely but firmly guiding a toddler to their designated spot during a family photo.

And there you have it! A perfectly centred title, ready to impress even the most discerning LaTeX aficionado. Now, go forth and create beautiful, well-aligned title pages! And remember, even the most frustrating LaTeX problems have a (usually slightly convoluted) solution. Just don’t let it drive you crazy! Or at least, not too crazy. Bon courage!