2

I am trying to write up an article that uses the xr package (or maybe it needs to be zref) to reference labels in two different documents: an article and a beamer presentation. The references from the other article work perfectly, it is the beamer references that show up as

Slide 1Doc-Start.

Where 1 is the frame number which I am trying to reference. Looking at the aux file produced by beamer the entry is

\newlabel{posvnorm}{{1}{1}{}{Doc-Start}{}}

If I manually delete Doc-Start from the aux file, the final output is what I desire. So if there is a way to write the label so "Doc-Start" isn't included, or suppressed when calling the label, I should be good to go. A a heads up, there will be multiple references to difference beamer slides in the main article.

Code for the main article:

    \documentclass[11pt]{article}
    \usepackage{xr}
    \externaldocument{../Folder1/mwe_article}
    \externaldocument{../Folder2/mwe_beamer}
    \begin{document}
    Slide \ref{posvnorm}

    Article \ref{pos} and \ref{norm}
    \end{document}

Code for the beamer slides

\documentclass{beamer}
\usetheme{Boadilla}
\usecolortheme{beaver}

\begin{document}

\begin{frame} \label{posvnorm}
\frametitle{Title}
Words go here
\end{frame}
\end{document}

Code for the article being referenced

\documentclass[11pt]{article}
\begin{document}
\begin{enumerate}

\item Blah \label{pos}


\item Blarg \label{norm}
\end{enumerate}
\end{document}
  • Welcome to TeX.SE. – Sebastiano Mar 13 at 22:15
2

The problem is that you mix documents which use hyperref (automatically loaded by beamer) with documents that don't use it. If you change the two article documents to include hyperref, the following works fine and even produces click-able like that will automatically open the linked documents:

\documentclass[11pt]{article}
\usepackage{xr-hyper}
\usepackage{hyperref}
\externaldocument{mwe_article}
\externaldocument{mwe_beamer}
\begin{document}
Slide \ref{posvnorm}

Article \ref{pos} and \ref{norm}
\end{document}

\documentclass[11pt]{article}
\usepackage{hyperref}
\begin{document}
\begin{enumerate}

\item Blah \label{pos}


\item Blarg \label{norm}
\end{enumerate}
\end{document}

enter image description here

  • Thank you! This works great. – Ryan Lee Mar 13 at 22:38
  • @RyanLee You're welcome! – user36296 Mar 13 at 22:46

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.