5

I would like to redefine Beamer's frame environment to provide different templates as part of a theme. However, I'm having some trouble accessing Beamer's variable from inside that code.

\documentclass{beamer}
\usepackage{tikz}
\title{Example}

\let\oldframe\frame
\let\endoldframe\endframe
\renewenvironment{frame}
{\oldframe%
\begin{tikzpicture}[remember picture,overlay]%
  {\node[draw,anchor=west,text width=.6\textwidth] at (1,0) {\insertframetitle};}%
\end{tikzpicture}}
{\endoldframe}

\begin{document}

\begin{frame}
  \frametitle{My Title}
\end{frame}

\end{document}

This produces no text inside of the text box. example.pdf

However, if I replace "\insertframetitle" with some fixed text, it works. enter image description here

Why is the variable not available in my environment?

1

1 Answer 1

2

I think this command is only available from inside a beamer template. In any case, redefining the frame environment is a bad idea. Instead, try changing the style using beamer template commands (you may need to adjust the spacing):

\setbeamercolor{frametitle}{fg=black} 
\setbeamertemplate{frametitle}{
  \vspace{4cm}
  \begin{tikzpicture}[remember picture,overlay]%
  {\node[draw,anchor=west,text width=.6\textwidth] at (1,0) {\normalsize \insertframetitle};}%
  \end{tikzpicture}
}

You must log in to answer this question.

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