auctex-devel
[Top][All Lists]

## [FR] RefTex support for zref-xr

 From: Gustavo Barros Subject: [FR] RefTex support for zref-xr Date: Tue, 30 Nov 2021 15:28:09 -0300 User-agent: mu4e 1.6.10; emacs 27.2

Hi All,


RefTeX has support for external documents, as defined by the xr' package, which is really useful when one is using it.


However, there's another package with similar functionality, but catering for zref' references, which is actually a module of zref' itself, named zref-xr'. Currently, RefTeX does not support it, and I'd like to suggest the inclusion of its support.


The working of zref-xr' is pretty much identical to that of xr', and the only syntax difference is that the command to import the references starts with a "z" (thus \zexternaldocument'), and it has a starred variant. As far as I can tell, it would suffice to adjust the regexp for it in reftex-parse-from-file' for these minor differences. Light testing suggest it works.

A MWE to illustrate the functionality of the package:

documentA.tex:

#+begin_src latex
\documentclass{article}

\usepackage[user,xr]{zref}

\zexternaldocument[B-]{documentB}

\begin{document}

\section{Section A1}
\zlabel{sec:section-a1}

\zref{B-sec:section-b1}

\end{document}
#+end_src

documentB.tex:

#+begin_src latex
\documentclass{article}

\usepackage[user]{zref}

\usepackage{hyperref}

\begin{document}

\section{Section B1}
\zlabel{sec:section-b1}

\end{document}
#+end_src


Of course, this will result in "No external documents available" if one tries to make a reference to sec:section-b1' from documentA.tex' with RefTeX. The example is just for the sake of easing things in case someone wants to try it out, and to motivate the request.


Side note: If I'm not mistaken, the current regexp would also fail to match if the nocite' argument from xr-hyper' is in use.

Best regards,
Gustavo.