0

My Professor is requiring me to write a script for my final presentation. I'm using LaTeX (because I can), and I'd like to reference my a slide from my beamer presentation within my script.

Right now I have two files, presentation.tex and script.tex.

presentation.tex:

\documentclass{beamer}

\title{My Presentation}
\author{John Smith}

\graphicspath{{src/}}

\begin{document}
\maketitle

\begin{frame}
    \begin{figure}[p]
        \centering
        \includegraphics[width=\textwidth,keepaspectratio]{myimage.png}
        \caption{This caption is important (Williams).\label{fig-1-williams}}
    \end{figure}
\end{frame}

\end{document}

script.tex

\documentclass{article}

\title{My Script}
\author{John Smith}

\begin{document}
\maketitle

\input{presentation}

\end{document}

I've encountered this question, which seemed similar to my question, however their question appeared to include the entire document, which is not my goal. I'd like to be able to reference a label of a figure in presentation.tex. Something such as the following:

As you can see by Figure~\ref{fig-1-williams}, dogs are better than cats.

How does one go about citing an out of document image like this? I believe the two documents should remain paired in some way, but I'm not sure how.

2
  • 1
    If you just want the references, check out the answers to tex.stackexchange.com/questions/14364/… (the question is about files from a single document, but the answers seem to do what you want). May 13 '19 at 9:52
  • After I rephrased my title I realized that there was another question quite similar to this, thanks. :)
    – William
    May 13 '19 at 11:43
1

The package xr-hyper can import labels from other documents :

\documentclass{article}

\usepackage{xr-hyper}
\usepackage{hyperref}


\externaldocument{presentation}

\title{My Script}
\author{John Smith}

\begin{document}
\maketitle

\ref{fig-1-williams}

\end{document}

Not the answer you're looking for? Browse other questions tagged or ask your own question.