Gustavo Barros <gusbrs.2...@gmail.com> writes: > On Wed, 01 Dec 2021 at 11:25, Arash Esbati <ar...@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.
Agreed. I will prepare a small patch. > 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. Agreed. I think adding support for zref to RefTeX is a source of trouble. > 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). You can have a function or a variable catering completion for package options, depends on the use case. > 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'? I guess this was the idea. I had a look at the list in the manual (section 2.7 Declared properties) and saw the Property lists and the properties. > 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. I thought \zref has an optional argument which can contain a property from a certain property list, e.g. \zref[page]{labelname} I think my first idea for the alist was that each zref-module adds its properties to `LaTeX-zref-properties-alist' which is then used for completion when \zref is called. But again, I really didn't grok the manual in this regard. Are the name of property lists used somewhere? Or only the name of the properties in the optional argument of \zref? > 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'. I didn't get that far :-) > 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'? My idea was to have everything basic in zref.el, I think. > 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. Yes, using `reftex-add-label-environments' is the right way. But that will be now of the table. > And thank you very much for considering my suggestion way beyond what > I expected! Thanks for your comments. I'll send you the styles for more feedback when I have something working, just don't expect fast progress :-) Best, Arash