[Tex/LaTex] reference to equation from other lecture in class beamer

beamercross-referencing

I'm using the class beamer to prepare lectures. I want to make a
reference to a formula given in last week's lecture, but I get only
question marks.

Example input:

\documentclass[handout]{beamer}

\includeonlylecture{week 2}

\begin{document}

\lecture{lecture 1}{week 1}
\begin{frame}
  \begin{equation}
    \label{eq:test}
      1=1
  \end{equation}
\end{frame}

\lecture{lecture 2}{week 2}
\begin{frame}
  \begin{equation}
    \label{eq:test2}
      2=2
  \end{equation}
equation(\ref{eq:test}) and (\ref{eq:test2})
\end{frame}

\end{document}

equation number 1 is correctly counted when calculating the number for
the second equation, but I did not manage to get acces to \ref{eq:test}.

Any hints?

thanks

Martin

Best Answer

Assuming you compiled the slides from week one with the jobname "test", you could do

\RequirePackage{xr-hyper}
\documentclass[handout]{beamer}

\externaldocument{test}
\includeonlylecture{week 2}

\begin{document}

\lecture{lecture 1}{week 1}
\begin{frame}
  \begin{equation}
    \label{eq:test}
      1=1
  \end{equation}
\end{frame}

\lecture{lecture 2}{week 2}
\begin{frame}
  \begin{equation}
    \label{eq:test2}
      2=2
  \end{equation}
equation (\ref{eq:test}) and (\ref{eq:test2})
\end{frame}

\end{document}

enter image description here