auctex-devel
[Top][All Lists]

## Re: [FR] RefTex support for zref-xr

 From: Arash Esbati Subject: Re: [FR] RefTex support for zref-xr Date: Wed, 01 Dec 2021 11:25:08 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50

Hi Gustavo,

Gustavo Barros <gusbrs.2016@gmail.com> writes:

> 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.

You're right, RefTeX only needs a hint in the regexp in that function.

> 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.

I can change that, but one issue which remains is that zref in general
operates on labels defined with \zlabel (I know that this doesn't apply
for \zexternaldocument without star).  Hence, RefTeX will offer all
labels it finds (defined with \label or \zlabel) for completion.  Of
course we have to tell RefTeX about \zlabel in advance.  This will also
apply to \zref macros when used with RefTeX.

I think we should add some styles to AUCTeX for the zref package(s).  I
played with it a while back, but didn't come up with anything useful --
mostly because I didn't grok the manual.  I'm attaching the 2 files,
maybe you want to have a look.

> 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.

It depends on the definition of "current regexp" ;-)
http://git.savannah.gnu.org/cgit/emacs.git/commit/lisp/textmodes/reftex-parse.el?id=74aaf8b72762ea65eb755321f0cb8561aca54479

Best, Arash



zref.el
Description: application/emacs-lisp

zref-user.el
Description: application/emacs-lisp