The motivation for this question

Forgive me if this looks very basic to you but nobody has pointed out to me yet until now in a comment to a question that the \title command (and thus the other two metadata commands \author and \date) should be placed in the preamble. My practice up to this point is to write them after \begin{document}. In titling's \thetitle, \theauthor and \thedate don't work and Best practice on organising your preamble, user doncherry mentioned to write them "towards the end" of the preamble.

I consulted lshort again and it seems to go towards putting these in the preamble. Here is an example code taken from lshort (page 8 in the English version).

% define the title
% generates the title
% insert the table of contents
\section{Some Interesting Words}
Well, and here begins my lovely article.
\section{Good Bye World}
\ldots{} and here it ends.

However, in some on-line tutorials like this one, they are written after \begin{document}.

The question:

What is the standard practice and are there advantages or disadvantages to each of these usage?

I am aware, for example, of the answers in the above-mentioned posts; but apart from these, are there more things to consider? For one, I don't get compile errors or warnings in most cases. Although I can't remember when I had such compile errors when these commands are written elsewhere where they are not intended to be written.

  • 8
    In Leslie Lamport's sample file (sample2e.tex), the commands are set immediately after the \documentclass. Since it does not matter, I prefer to set it after the \begin{document} to keep it close to other document content. On the other hand setting it at the top makes the title show as soon as one opens the document which may be an advantage. So there are good reasons for different solutions. – Peter Jansson Jan 14 '13 at 7:42
  • 5
    @PeterJansson -- sample2e.tex notwithstanding, in section C.5.4 of lamport's manual, it states (p.181) "Information used to produce the title is obtained from the following declarations ... It's best to put these declarations in the preamble." (i don't agree with this for several reasons, including the action of babel, but that's the official word.) – barbara beeton Jan 14 '13 at 13:37

Conceptually, these are 'meta-data' about the document, rather than part of the document itself. As such, I prefer to set them in the preamble.

As others have noted there is no technical reason to prefer one method over the other with the standard classes and in the absence of packages which alter category codes. With classes which issue \maketitle automatically, it may however be essential to set \author, etc. in the preamble. The same is true if the meta-data is being picked up by for example hyperref for addition to the PDF information.

  • 13
    Of course latex is a bit conflicted here (what a surprise:-) in that while a documents author might be meta-data about a document, for a document in which the author's name is printed as part of the title structure it is part of the printed character data of the document (as well). That conflict shows up in half the answers saying to use it after begin{document} (for babel and other usage) and those that say it is part of the meta data. I suspect the answer for 2e is do whatever works, and for l3 we should have a plan.... – David Carlisle Jan 14 '13 at 10:14
  • @DavidCarlisle Thinking aloud the pdf metadata - which repeats most of this info is in the preamble. Just for this alone hoping l3 would place it there (if we get an l3 hyperef). – Yiannis Lazarides Jan 14 '13 at 10:25
  • @DavidCarlisle I do have a plan ;-) I'd like a richer approach to meta-data, which I think should be in the preamble. The problem then is to handle any active chars, but we seem to be planning there to have a fixed set of supported ones, which therefore will apply in the preamble and the document body equally. – Joseph Wright Jan 14 '13 at 12:53
  • You have convinced me. I see the counter-argument when using babel in the other answers. But at the moment, this is what I find the most helpful. BTW, @DavidCarlisle I also see your comment as very helpful. It could have been a separate answer. Specially one that contains the last sentence. – hpesoj626 Jan 15 '13 at 2:00

With package babel it is always better to use it after \begin{document}. Then the shorthands are active and can be used for hyphenation points:

\title{Das ist ein Mustertext, der dazu da ist, um Textsatz"=Problematik
    bzw. Textsatz"=Schwierigkeit eindeutig zu demonstrieren}

enter image description here

In the preamble you have to set the title without using the shorthands:

\title{Das ist ein Mustertext, der dazu da ist, um Textsatz-Problematik
    bzw. Textsatz-Schwierigkeit eindeutig zu demonstrieren}

enter image description here

It is possible to activate the shorthands in the preamble before the \title is used, but that is one more command and can cause other problems ...

  • 1
    What kinds of problems could \shorthandon{"}\author{...}\title{...}\shorthandoff{"} cause? – doncherry Jan 14 '13 at 21:27
  • 1
    If you have it directly before \begin{document} then there should be no problems. But if you load other packages after the activated shorthands it is not really safe. – user2478 Aug 30 '14 at 8:59

Try this:

\title{This is a test}


As you can observe, some classes are opiniated and want you to place it in the preamble. From memory it may also affect other packages such as hyperref. Best place it where Leslie Lamport thought it belonged i.e., in the preamble.

  • I haven't used tufte-book before so thanks for this example. – hpesoj626 Jan 14 '13 at 8:24
  • 1
    This should no longer be the case in recent versions of the Tufte-LaTeX document classes. – godbyk Jan 15 '13 at 19:13
  • @godbyk I am glad you commented and that this issue has been fixed, although personally I prefer to have the title in the preamble. – Yiannis Lazarides Jan 15 '13 at 19:16
  • @YiannisLazarides, As do I. I thought that was the universal convention until someone informed me the LyX was placing it after the \begin{document} and encountering compilation errors. – godbyk Jan 15 '13 at 19:47
  • Thanks for the information @godbyk and for the work you do on the tufte-latex document classes. I've been trying it since Yiannis posted this answer. – hpesoj626 Jan 16 '13 at 1:39

IIRC, you won't be able to use babel shorthands if your \title etc. are in the preamble unless you use external packages to enable it. Of course, with many people using sufficiently rich encodings anyway, this becomes less and less of a problem.


Some classes require \title, \author and similar declarations to be placed after \begin{document}. An example is revtex which is a standard class for submission of scientific papers to physical journals of APS, AIP, etc. IMHO, it is better to put these commands in the preamble. For some reasons revtex uses a different approach. I don't know exactly why. Maybe, bacause \begin{abstract}...\end{abstract} should go before \maketytle in this class.


I will elevate my comment to an answer and make a few corrections and additions:

In Leslie Lamport's sample file (sample2e.tex; thinking of it as THE original), the commands are set immediately after the \documentclass. Since it in many cases does not matter (see the other replies for cases the contrary), I prefer to set it after the \begin{document} to keep it close to other document content (I often end up changing the title in response to changes in the text). On the other hand setting it close to the top makes the title show as soon as one opens the document which may be an advantage. So there are good reasons for different solutions.


That's no difference where you place them. They just should be before \maketitle.

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.