I'm working on a beamer theme custom tailored to my needs. Now I need to introduce a custom field or tag \MYTAG, similar to \frametitle that holds certain information and may be retrieved in the .sty-files via \insertMYTAG, again like \insertframetitle. I tried to mimick it but failed utterly. I would use it like in the following excerpt from my beamerouterthemeMYTHEME.sty

\defbeamertemplate*{frametitle}{MYTHEME theme}
    \insertframenumber\hskip1em \insertframetitle \insertMYTAG%

Can anyone give me a hint on how and where to define this tag?

  • tnx Stefan for inline highlighting
    – juisoo
    Mar 21 '16 at 14:17

Beamer has the original definitions for the different \insert-commands in the file beamerbasetitle.sty. This is the definition for the date command for example:

% The \date command


For your needs you can use:

% The \MYTAG command
  \def\insertMYTAG{#2}  %

which will work analogously to \author[]{}, \date[]{}, \institute[]{} and so on.

  • Thanks for your answer. Do I need to define this command in the same file (i.e. beamerbasetitle.sty) or can I do this in my beamerthemeMYTHEME.sty? If I do the latter I get an ! Undefined control sequence on the line making the call with the default values (last line in your example).
    – juisoo
    Mar 21 '16 at 15:01
  • Dooh, stupid me. Seems like I misinterpreted the error message. I defined the command AFTER defining the outertheme which uses the \insertMYTAG command. Moving the definition up, it works now. Big thanks!
    – juisoo
    Mar 21 '16 at 15:08
  • Feels like it shouldn't matter where in your .sty file you put the definition. You need to have in in the .sty file or in your preamble surrounded by \makeatletter and \makeatother though. Anyhow, I'm glad it's of use to you! I spent quite some time understanding how beamer does this when I was creating a theme of my own.. :)
    – user49901
    Mar 21 '16 at 15:16

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.