# How can I fix the problem of \ref command when I have been used overlays in beamer

How can I fix the problem of \ref command when I have been used overlays in beamer?

This problem appears to me when I use overlays. Here is an example

\documentclass[notes=show,12pt]{beamer}

\usepackage{lmodern}
\usepackage[T1]{fontenc} % fonte codificado em em T1 (8 bits)
\usepackage[latin1]{inputenc} % letras acentuadas
\usepackage{color}

\begin{document}

\frame { \frametitle{First Theorem}
Consider the equation
$\cos^2(x) + \sin^2(x)=1$

\begin{overprint}
\onslide<2>
Let bla bla...

\onslide<3>
\begin{theorem}{\label{T1}}
If
$$\label{E1} x = \pi$$
then bla bla bla
\end{theorem}
\onslide<4>
\begin{exampleblock}{Observation}
The conclusion of Theorem \ref{T1} remains valid if the condition \eqref{E1} is replaced by $x = 2\pi$
\end{exampleblock}

\end{overprint}

}

\end{document}

-
Welcome to TeX.sx! A tip: If you indent lines by 4 spaces or enclose words in backticks , they'll be marked as code, as can be seen in my edit. You can also highlight the code and click the "code" button (with "{}" on it). –  Martin Schröder Feb 2 '13 at 20:17
Please elaborate: What is the problem? –  Martin Schröder Feb 2 '13 at 20:19
My problem is: when I using the command \label{XXX} in an equation on slide 2 (for example) and I'm going to use \eqref{XXX} on slide 5, then has been appeared (??) –  Moura Feb 2 '13 at 20:31
Please edit your question and include that information. –  Martin Schröder Feb 2 '13 at 20:52
Beside the fact that it is possible according to the answer below, I don't think it is useful. People normally won't remember what was equation xxx from several slides before. In many cases people even cannot remember what was on the before the current one. Therefore this could only be useful if the referenced equation is really easy to remember (E=mc^2 or so) and then it would maybe be easier to reprint it. –  Benedikt Bauer Feb 2 '13 at 23:29

You can use \label<3> to get it on to the same layer as is output. Also I think frame wants to be an environment.

\documentclass[notes=show,12pt]{beamer}

\usepackage{lmodern}
\usepackage[T1]{fontenc} % fonte codificado em em T1 (8 bits)
\usepackage[latin1]{inputenc} % letras acentuadas
\usepackage{color}

\begin{document}

\begin{frame}
\frametitle{First Theorem}
Consider the equation
$\cos^2(x) + \sin^2(x)=1$

\begin{overprint}
\onslide<2>
Let bla bla...

\onslide<3>
\begin{theorem}{\label<3>{T1}}
If
$$\label<3>{E1} x = \pi$$
then bla bla bla
\end{theorem}
\onslide<4>
\begin{exampleblock}{Observation}
The conclusion of Theorem \ref{T1} remains valid if the condition \eqref{E1} is replaced by $x = 2\pi$
\end{exampleblock}

\end{overprint}

\end{frame}

\end{document}

-
While one can use \frame{...}, the syntax \begin{frame}...\end{frame}` is cleaner and it's less easy to forget ending the frame. –  egreg Feb 2 '13 at 20:40