[Tex/LaTex] Using xr to refer to another document without hyperref

cross-referencingxr

I have two documents A and B. I wish to refer to theorems and lemmas from A in B. To do this I am using the package xr in B.

If I use the package hyperref in B then it's all fine. Otherwise, when I write something like

from Theorem \ref{thm:1}

it looks like

from Theorem 1.1theorem1.1

which is not what I wanted. How I do get rid of the "theorem1.1" part at the end? I do not want to use hyperref because I do not want people to click the links in B. Thanks.

Best Answer

Package zref-xr provides many options for importing references with support of many packages (hyperref, titleref, ...).

Example file A.tex with hyperref, which contains the theorems:

\documentclass{article}
\usepackage{hyperref}
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}
\label{thm:1}
\end{theorem}
\end{document}

File B.tex without references imports references from A:

\documentclass{article}

\usepackage{zref-xr}
\zxrsetup{toltxlabel=true, tozreflabel=false}
\zexternaldocument*{A}

\begin{document}
from Theorem \ref{thm:1}
\end{document}
Related Question