[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [FR] RefTex support for zref-xr
From: |
Gustavo Barros |
Subject: |
Re: [FR] RefTex support for zref-xr |
Date: |
Wed, 01 Dec 2021 08:11:24 -0300 |
User-agent: |
mu4e 1.6.10; emacs 27.2 |
Hi Arash,
On Wed, 01 Dec 2021 at 11:25, Arash Esbati <arash@gnu.org> wrote:
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.
You're right, of course. The reason I asked for one thing, and not the
other, is that an interested user can handle \zlabel/\zref from a
personal style file, but tampering with `reftex-parse-from-file' becomes
impractical for this purpose.
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.
But, that would be even better! :-)
Indeed, `zref' is very much an "infrastructure" kind of package, from
its reasonably large feature set, only a fraction takes the shape of
"document commands" for the regular user. And the manual does
correspond to this.
The style files you've sent look good (specific comments below), but
before you choose to go with this, I think there is one aspect of it to
ponder. The referencing system of `zref' is independent from the
standard one. Among other things this means the label sets are
independent. A label set with `\label' cannot be referenced with
`\zref' and a label set with `\zlabel' cannot be referenced with `\ref'.
Also setting both `\label' and `\zlabel' with the same refname is not a
duplicate label. This may trip RefTeX in a number of places. For
example, when choosing a label for `reftex-reference' how will one know
whether the label comes from `\label' or `\zlabel'? Or, if one wants to
set a `\label' and a `\zlabel' with the same name, how would RefTeX know
it doesn't "already exist" for the second one?
And I wouldn't say that `zref'/`zref-user' tends to be used as a
"replacement" for the standard reference system. As it currently
stands, my bet would be that people search `zref' for one or another
specialized task, and use it alongside `\label'/`\ref'.
I'm not suggesting this should be actually handled, just bringing it to
your attention that "telling RefTeX about \zlabel" does complicate
things. I realize that may be playing against the inclusion of the
styles, but I prefer you decide well informed.
It depends on the definition of "current regexp" ;-)
http://git.savannah.gnu.org/cgit/emacs.git/commit/lisp/textmodes/reftex-parse.el?id=74aaf8b72762ea65eb755321f0cb8561aca54479
Oh! I meant "current released regexp", I had missed that. ;-)
[2. application/emacs-lisp; zref.el]...
[3. application/emacs-lisp; zref-user.el]...
As you've noticed, `zref.sty' is just a "wrapper" which loads
`zref-base' and any other modules received as options. So, `zref.el'
pretty much corresponds to what I'd expect. My own personal style file
for it includes a `LaTeX-zref-package-options' function, but I don't
remember why I put it there. (Perhaps to feed completion? If you don't
know it already, I can investigate).
The only other comment I have to `zref.el' is about
`LaTeX-zref-properties-alist'. First, you've chosen to make it an alist
being `car' the property list name. Is the intended use for this to
choose first the list, then the property when making a `\zref'? If
that's the case, `\zref' has no choice at all about what list it is
referring to. The property list can affect the properties which get
included when setting the label (`\zlabel' itself always uses the "main"
list). '\zref' can only query whatever the label contains, so it's
really not that meaningful to choose the property list at that point,
I'd say. And it saves a completion step not doing so.
Another related suggestion would be to have `zref-titleref.el' adding
"title" to `LaTeX-zref-properties-alist', which would be a common need,
I think. For which there's also `\ztitleref' and `\ztitlerefsetup'.
Second, the "default" and "page" properties are actually defined in
`zref-base', and one does not need to use `zref.sty' if one does not
want to. So, one can load `\usepackage{zref-user}', and `zref-base.sty'
is called, but `zref.sty' isn't. The same for any other module. If I
understand correctly, that's what you meant to handle by doing
`(TeX-run-style-hooks "zref")' in `zref-user.el'. But wouldn't it be
more idiomatic to have `zref-base.el'?
About `zref-user.el'. Also corresponds to what I'd expect. On my own
file, I use the procedure adapted from `cleveref.el' for
`reftex-label-regexps'. I don't understand well how you deal with that
through `reftex-label-alist', but I presume it is covered. I also have
here `(reftex-add-label-environments '(("\\zlabel{*}" nil nil nil
nil)))', perhaps is what you meant to be covering there, I'm not sure.
`zref-user.sty' defines one further command which is not documented:
`\zkvlabel'. I actually have a hard time even telling you what its
syntax is (Oberdiek's code is frequently beyond my depth), but it
exists. (The alist form of `LaTeX-zref-properties-alist' may be useful
in this scenario).
`font-latex-add-keywords' is missing "zpageref" (and, perhaps,
"zkvlabel").
The only other thing I have here is `(reftex-ref-style-activate
"Zref")', but that would likely be a little bold for upstream. ;-)
And thank you very much for considering my suggestion way beyond what I
expected!
Best regards,
Gustavo.
- Re: [FR] RefTex support for zref-xr, Arash Esbati, 2021/12/01
- Re: [FR] RefTex support for zref-xr,
Gustavo Barros <=
- Re: [FR] RefTex support for zref-xr, Arash Esbati, 2021/12/03
- Re: [FR] RefTex support for zref-xr, Gustavo Barros, 2021/12/03
- Re: [FR] RefTex support for zref-xr, Arash Esbati, 2021/12/06
- Re: [FR] RefTex support for zref-xr, Gustavo Barros, 2021/12/06
- Re: [FR] RefTex support for zref-xr, Arash Esbati, 2021/12/10
- Re: [FR] RefTex support for zref-xr, Gustavo Barros, 2021/12/11