62

I've started to write my own theme for beamer. I'm bored of the default ones and I thought it might be a nice challenge to make something that looks good. The problem is that the beamer documentation doesn't really offer much in the way of explanation of how to write your own themes. It explains a little about what \defbeamertemplate does, but it doesn't explain, for example, that to customise the frame title you need to set up your own templates for frametitle and headline. I had to work this out by looking at what the default themes actually do.

So my question is quite general: how does beamer build the frame? What template entities do I want to define to customise how beamer looks? And what does beamer actually do with them?

For example, presumably at some point something is calling \usebeamertemplate{frametitle}[<my theme>] and \usebeamertemplate{headline}[<my theme>] but how and when?

1
  • 4
    Have you read Section 8.2 of the beamer manual "Components of a Frame"? Aug 22, 2011 at 20:01

1 Answer 1

82
+100

Here's half an answer.

The reason that it is half an answer is because of the way that beamer builds a frame. In essence, the stuff on a frame can be divided in to "frame" and "content". The "frame" component is actually typeset by hooking in to the headers and footers bit of TeX's output routine. This ensures that it goes behind the actual content. The "content" is then rendered afterwards. The "frame" component consists of all the stuff like backgrounds, sidebars, and so forth. Interestingly, the frame title is part of the "content".

What I've worked out so far is the order in which the "frame" stuff is laid out, and (mostly) what it consists of. To follow the trail, you need to look at the definition of \ps@navigation in beamerbaseframecomponents.sty and search for everywhere it has a \usebeamertemplate (though you have to be on the lookout for calls to other functions that also call templates).

Exactly what each piece is and how it is to be used is covered in the manual (section 8.2) as Matthew says, but that doesn't tell you the order (well, not obviously) and on the basis that a picture is worth a thousand words anyway, I thought that the following pictures might help.

First, a frame itself:

A beamer frame

And now the exploded diagram, at least as far as the "frame" part goes.

An exploded frame

It's not quite the same as I didn't take apart the templates and reuse them, but hopefully each bit is unique enough to show what it is.

With regard to the content, then there's less need to do the "explosion" because stuff tends not to get put on top of other stuff, so then it's just a question of knowing what can go in to a frame. The exception is, perhaps, the frame title which one could consider as part of the "frame" part but which, by reason of implementation, is in the "content" part. So for that, reading the beamer user guide is probably as good as you're going to get.

I shan't put the code for doing the above. It isn't pleasant! Nor is it readily adaptable to other situations.

10
  • 3
    I don't know if this was already the case when this answer was written, but as of today it is not sidebar left canvas but sidebar canvas left (same for right). Feb 23, 2015 at 21:13
  • 2
    Wow! Could you share the code of this exploded diagram? Mar 25, 2018 at 8:33
  • 3
    @DenisBitouzé As I put in the answer, the code (now over 6yrs old!) is horrible and doesn't provide any insights. If you want to make an exploded diagram of something, you should ask a fresh question (you could link it to this one if you like) but the code I used would not help you do that. Mar 26, 2018 at 20:31
  • @AndrewStacey I would like to include a similar diagram in the beamer user guide. Would it be ok for you if I would recreate your drawing? Nov 1, 2021 at 13:33
  • @samcarter_is_at_topanswers.xyz Of course! Do you need the code, or are you doing your own reconstruction? Nov 1, 2021 at 16:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .