1

The following MWE displays the problem.

\documentclass{beamer}

\begin{document}

\begin{frame}{Frame 1}
    \def\test{hello}
    \test % prints hello
\end{frame}

\begin{frame}{Frame 2}
    \test % should print hello, but doesn't
\end{frame}

\begin{frame}{Frame 3}
    \def\test{something new}
    \test % prints something new 
\end{frame}

\begin{frame}{Frame 4}
    \test % should print something new 
\end{frame}

\end{document}

I am using \def simply because it came as part of an answer I found elsewhere on this site. It seems that the macro \test is only defined within the scope of the environment (in this case frame so perhaps the problem isn't beamer dependent). How can I have the command \test defined globally (from this point on)?

Geoff
  • 2,637

0 Answers0