auctex-devel
[Top][All Lists]

Re: [FR] RefTex support for zref-xr

 From: Arash Esbati Subject: Re: [FR] RefTex support for zref-xr Date: Fri, 10 Dec 2021 23:14:56 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50

Hi Gustavo,

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

> On Mon, 06 Dec 2021 at 09:26, Arash Esbati <arash@gnu.org> wrote:
>
>> After thinking about it, I think there is a chance to use RefTeX with
>> something like this:
>>
>>      '(("\\zlabel{*]" ?z nil nil nil)))
>
> I've taken a look at it and agree that's an interesting idea. We still
> get them all together when using the SPC typekey, but there's a way to
> separate them. Though, indeed, there's no way to narrow by type for
> zlabels, this may be a good compromise, I think.

Thanks, I think this can a be compromise for all users: Serious \zlabel
users will to use it exclusive as a replacement for \label, and casual
users will have two label circles.

> But, if I may make a request, would you consider offering a variable
> for those who may want a ("\\zlabel{*}" nil nil nil nil)' kind of
> behavior?

Sure, see the attached file and the variable
LaTeX-zref-reftex-quick-id-key'.

> (btw, as far as I can tell, there's a typo on that closing brace at

Thanks, good catch.

> I've made some light testing here and choosing labels from
> reftex-reference' seems to be working well, but setting a \zlabel'
> always gives me "z-1", "z-2", "z-N" labels (no prompt, no
> TeX-read-label-prefix', no nothing).

This is the Naked label' in RefTeX.  Our labels are not bound to any
sections/environments, and for the others, RefTeX takes \label (which is
hard-coded, AFAICT).

> I've had another idea here around this issue.  It is actually
> orthogonal to your approach from the technical side, and may be an
> alternative or a complement to it.  It would be adding a (e.g.)
> TeX-zlabel-prefix' to zlabels, so supposing a prefix "z:" we could
> have, for example "z:sec:foo", "z:fig:bar" etc.

The issue is that \zlabel doesn't get a prefix like 'fig:' in the first
place, adding 'z:' should be easy with RefTeX (didn't test it though).

I have another idea: For serious users, we can replace \label with
\zlabel.  For sectionning commands, we need to add function to
LaTeX-section-hook' which looks back for a \label and adds a 'z' to it.
For environments, the same logic would apply, but
LaTeX-after-insert-env-hook' is not the right place since it is run to
early.  I have to think about it.  See attached a new version with the
first idea implemented.  Maybe you want to give it a roll. You have to
set LaTeX-zref-replace-label' before it works.

> zref-abspage.el' and zref-lastpage.el' look good.

Thanks.

> Some stuff I had mentioned previously I'm assuming you just didn't
> take a look at them yet, so no need to reiterate.

We'll come back to that later :)

> I'm not sure I can see well all the ramifications of
> LaTeX-zref-read-zlabel',

Now we are 2 ;-)

> Thank you once again for the quick new "incarnation" and,
> particularly, for bringing RefTeX support back on the table.

Best, Arash


zref.el
Description: application/emacs-lisp