[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reftex support for nameref and user defined refs
From: |
Uwe Brauer |
Subject: |
Re: reftex support for nameref and user defined refs |
Date: |
Sat, 19 Aug 2023 10:45:41 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
>>> "AE" == Arash Esbati <arash@gnu.org> writes:
> Uwe Brauer <oub@mat.ucm.es> writes:
>> I have cooked up a new simple command that I called fullref
>> \newcommand*{\fullref}[1]{\hyperref[{#1}]{\autoref*{#1} (\nameref*{#1})}}
>>
>> So I wanted that reftex supports this label-ref.
>>
>> I found a solution provided by you in
>> https://tex.stackexchange.com/questions/506586/adding-new-label-reference-command-pairs-to-reftex
>>
>> Which I modified for my purposes. I attach both files, I presume they
>> are overkill
> IIUC, you can reduce the whole thing to a fulllabel.sty which looks like
> this:
> \ProvidesPackage{fulllabel}
> [2019/09/08 v1.0 Support for fulllabel's]
> \RequirePackage{hyperref}
> \newcommand*{\fullref}[1]{%
> \hyperref[{#1}]{\autoref*{#1} (\nameref*{#1})}%
> }
> \endinput
> and a fulllabel.el which looks like this:
> (TeX-add-style-hook
> "fulllabel"
> (lambda ()
> (TeX-run-style-hooks "hyperref")
> (TeX-add-symbols
> '("fullref" TeX-arg-ref))
> ;; Fontification
> (when (and (featurep 'font-latex)
> (eq TeX-install-font-lock 'font-latex-setup))
> (font-latex-add-keywords '(("fullref" "{"))
> 'reference)))
> TeX-dialect)
Thanks, but what's about the reftex support that is in my original post,
stuff like
,----
| (when (featurep 'reftex-vars)
| (make-local-variable 'reftex-label-alist)
| (make-local-variable 'reftex-label-regexps)
| (make-local-variable 'reftex-ref-style-alist)
| (dolist (mac '("fulllabel" "fulllonglabel"))
| (add-to-list 'reftex-label-alist
| `(,(concat "\\" mac "{*}") nil nil nil nil)
| t)
| (add-to-list 'reftex-label-regexps
| (concat "\\\\" mac "{\\(?1:[^\n\r%\\{}]+\\)}")
| t)
| (unless (string-match-p
| "\\<fulllabel\\>"
| (mapconcat #'identity reftex-label-regexps "\\|"))
| (reftex-compile-variables)))
|
| ;; Add a new reference style
| (add-to-list 'reftex-ref-style-alist
| '("PFlabel" "fulllabel"
| (("\\fullref" ?f)))
| t)
|
| ;; And activate it
| (and LaTeX-reftex-ref-style-auto-activate
| (fboundp 'reftex-ref-style-activate)
| (reftex-ref-style-activate "PFlabel")))
`----
This is what I most need, the possibility that reftex finds the labels
and inserts \fullref not just \ref
> I don't understand the dance for \fulllabel and \fulllonglabel where you
> do
> \let\fulllabel\label
> and \fulllonglabel isn't defined in your LaTeX package at all. So why
> adding them to AUCTeX and RefTeX machinery at all where you can use
> \label?
Most like I just was tired, and forgot to delete, it, sorry
Uwe
> Best, Arash
--
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military.
I support the NATO membership of the Ukraine.
I support the EU membership of the Ukraine.
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/
smime.p7s
Description: S/MIME cryptographic signature