I am attempting to change the font and size of the title through means of the titling package.

In the documentation, it is described that the \maketitle now looks something like this:

  {\pretitle \title \posttitle}
  {\preauthor \author \postauthor}
  {\predate \date \postdate}

And that the \pre & \post macros can be used to change the typesetting of the title. Also the \maketitlehookX can be used to add stuff or change formatting. I've noticed that the \pre and \post macros only seem to work when I explicitly create a group or an environment within which I do my work (be it changing formatting or adding some extra text to the title). But if I add the text or formatting as arguments to the \pretitle macro I get an error:

LaTeX Error: \begin{titlepage} on input line 9 ended by \end{center}.

However if I \renewcommand\maketitlehooka with the same text/formatting it works fine. I suppose the question is what is different between redefining a macro as described and passing the same code as an argument? or Why do I need to explicitly need to start a group within the {...} which already surrounds the pre/post title-group?

A minimal working example:

\usepackage{titling}    % taking control over the title format
%\renewcommand\maketitlehooka{\sffamily\bfseries} % Works
%\pretitle{\sffamily\bfseries} % Does not work
\pretitle{\begingroup\sffamily\bfseries} % This also works, kind of
\posttitle{\endgroup} % but needs this and will mess up some other formating
\title{The title}

It is worth noting that redefining \maketitlehooka requires only some small changes to make it look like I want while using \begingroup\endgroup will flush everything right and reset the font size. So \begingroup\endgroup might not be exactly what I'd want to use here.


It's because of the default definitions \pretitle and \posttitle. Their definitions at package load (from titling.dtx are

\posttitle{\par\end{center}\vskip 2em}

So, updating \pretitle to


leaves an unpaired \end{center} in \posttitle which causes the problem. So, you either need to redefine both, or add your formatting as part of it. Here are some options:

  • Appending content to \@bspretitle - the macro holding whatever is passed to \pretitle:

  • Redefining \pretitle entirely but include the original

  • Updating both \pretitle and \posttitle if you want to remove the center environment and \LARGE formatting:


    There is no need for a group here, since the group is already established in the definition of \maketitle.

  • Updating \maketitlehooka to insert the content in the appropriate location:


    Note the additional group to limit the scope of the formatting. This is because we've redefined \maketitlehooka to take an argument. This argument removes the original definition scope.

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.