How can I use color declarations when setting the title of a document?

I tried

\title{\color{blue} Colors in typesetting}

but I get an error from LaTeX.

Update: The error reads as followed:

doc.tex:89: Argument of \reserved@a has an extra }.
<inserted text> 
l.89 \begin{document}

Can I define a declaration or an environment which works inside \title? Or is there a way to enhance the definition of \title to accommodate declarations?

Update 2: To give more context, the base class pandoc uses here is beamer, but it draws in a lot of packages. (beamer itself behaves correct as the standard classes.)

Note: For technical reasons(*) I do not want to use

\title{\textcolor{blue}{Colors in typesetting}}

so, as stated above, it must be a color declaration.

(*) I really use pandoc to generate the TeX document from markdown and parameter-taking commands like \command{text} will skip "text" if I convert the markdown document to any other output format.

  • An open \color{blue} statement is 'dangerous'. Bleeding blue colour in to the rest of the document is avoided here due to grouping. – user31729 May 27 '15 at 5:02
  • Which error message do you get? The solution that @jak123 suggests should be equivalent to \title{\color{blue}{My Title}} (I would rather say \title{{\color{blue}My Title}}, though). Unfortunately, I'm away from my desktop, now, so I cannot check with a compiler. – GuM May 27 '15 at 5:09
  • @GustavoMezzetti See my updates to the question. – halloleo May 27 '15 at 5:13
  • You need to give a minimal working example . With any class that I have tried, including beamer, using \title{\color{blue}...} works fine. – user30471 May 27 '15 at 6:07
  • With the KOMA-classes, you can set font attributes and coloring to a special variable. The title-field really should only contain the title, nothing more. – Johannes_B Jun 16 '15 at 14:51

I'm sure there is a package for that, but here is a solution based on redefining the maketitle command (for the article class).

Create a style file (I saved as titlecolor.sty) with the following content (I copied this from the book.cls file and add the \color command to the title, you can change the format):

  \let \footnote \thanks
  \vskip 60\p@
    {\LARGE \color{blue}{\@title} \par}%
    \vskip 3em%
     \lineskip .75em%
      \vskip 1.5em%
    {\large \@date \par}%       % Set date in \large size.

Put \usepackage{titlecolor} in your document:

    \usepackage{xcolor} % You need this also of course

\title{My title in Blue}



Now you will get a coloured title.

enter image description here

  • Well, I'm curious whether there is a package to make declarations possible in titles... – halloleo May 27 '15 at 4:45
  • Of course, this patch to \maketitle forces a separate title page even if the notitlepage option has been specified. – GuM May 27 '15 at 5:00
  • @GustavoMezzetti I have no clue if it would. But it is just a redefinition of a class command, why would it behave differently than the original one? – jak123 May 27 '15 at 6:27
  • 1
    @jak123: I apologize for not having read your comment until now. Well, the point is that the article class, and many others, define the \maketitle command in two different ways depending on whether the titlepage option has been specified or not; but your patch unconditionally uses the definition valid for titlepage. You should say \if@titlepage \renewcommand\maketitle{<def. for titlepage>} \else \renewcommand\maketitle{<def. for notitlepage>} \fi. Look closely at the code in article.cls. – GuM Jun 1 '15 at 2:54

For standard classes there's the titling package.

After the edit to the question, the class used here is beamer. In this case, the answer is really simple since beamer provides an easy way to change the color attributes for the title:


\title{The Title}




The result:

enter image description here



fg stands for foreground and bg for background. In my example I changed both for illustration purposes, but ou can change only one of them.

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.