4

At some stage of my frame environment, I want to access the current value of the frame title, and then construct and effect a new frame title based on the original value.

Sounds convoluted, doesn't it? I hope this will better explain what I'm trying to achieve:

\documentclass{beamer}

\begin{document}
    \begin{frame}
    \frametitle{Foo}                    % original title: Foo
    ...
    % Here, I want, for instance, to append "bar" to the 'current' frame title.
    % \insertframetitle is defined here
    \let\currtitle\insertframetitle     % to avoid recursion
    \frametitle{\currtitle bar}         % desired new title: Foobar
    \end{frame}
\end{document}

I thought \let\currtitle\insertframetitle would be enough to keep me out of trouble, but I get the error

Undefined control sequence. \insertframetitle

and I don't understand why...

The original title should only be used to construct the new one and is not meant to be printed unchanged in the output. The reason I must solve this problem is that I want to define a new frame environment in which the original frame title (provided by the user) is processed and used to construct the effective frame title, based on the contents of the frame environment.

  • Do you want the frame(s) to be produced only with the new title or with both old and new? The way beamer works the latter case is going to be hard work. – Joseph Wright Aug 25 '13 at 19:43
  • @JosephWright Only with the new title. This is for defining a new frame environment in which the original frame title (provided by the user) is processed and used to construct the effective frame title, based on the contents of the frame environment. – jub0bs Aug 25 '13 at 19:46
4

Your problem is that beamer doesn't define \insertframetitle just to the text, and resets/removes definitions at various points. What your therefore want to do is re-run \frametitle with the stored text of the frame name, \beamer@frametitle:

\documentclass{beamer}
\makeatletter
\newcommand*{\augmentframtitle}[1]{%
  \expandafter\frametitle\expandafter
    {\beamer@frametitle #1}%
}
\makeatother
\begin{document}
\begin{frame}
  \frametitle{Foo}
  ...
  \augmentframtitle{bar}
\end{frame}
\end{document}
  • Thank you very much. Got it! So simple a solution, yet so elusive :) – jub0bs Aug 25 '13 at 20:04

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.