I get a very strange phenomenon I don't understand

here is a MWE





 \textcolor{frametitle.fg}{Does not work}

 \textcolor{frametitle.fg}{Does work}


So the problem is that while on the second slide I cannot call frametitle.fg as a color option, I can do so for all slides later on (I get "Undefined color frametitle.fg" as an error for slide 2 only).

The frametitle of slide 2 is however in the right color.

I suspect it is because I use a [plain] slide for the title page. However, I want to keep this but want to display some text with color frametitle.fg on the second slide.

Is there any way to do this?

  • Maybe I should add: I can call colors such as title.fg, though. So it does not seem to be the case that xcolor is not working but has something to do with how beamer (re-)defines frametitle – johaschn Oct 21 '15 at 8:14
  • 2
    Not sure why, but adding \usebeamercolor{frametitle} before second frame solves the problem about Undefined color frametitle.fg. – Ignasi Oct 21 '15 at 8:18
  • 1
    It seems like the frametitle colour gets activated only after the first call to \frametitle. You do it in second slide and the colour is available from next slide. Either put a \frametitle in title page slide (which you won't want to do) or do as Ignasi says. – user11232 Oct 21 '15 at 8:42

@Ignasi and @Harish Kumar provided some solutions. And this is why.

Beamer uses a complex system to handle colors. Briefly speaking, when you saw something like


frametitle is a bundle of colors so that you can set the foreground and background colors at the same time by just one command.

The subtle part is, while you can use frametitle.fg to access the color, Beamer stores the color elsewhere and calculates it on the fly. As can be seen in the following example, the title is typeset in green.

    \frame{{purple or orange?}}

This design has the advantage that, when you change the "parent colors", all "child colors" are updated. In particular, you can change the theme at the middle of your presentation.

Now we may conclude that frametitle.fg is undefined because \usebeamercolor is not called yet. But how could it not be called? The only possibility is that Beamer reads the entire frame before it typesets the title. That does make sense because Beamer needs to find out the \frametitle throughout the frame.

        \frametitle{purple or dirt?}

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.