auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: reftex support for nameref and user defined refs


From: Arash Esbati
Subject: Re: reftex support for nameref and user defined refs
Date: Sat, 19 Aug 2023 09:03:48 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

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:

--8<---------------cut here---------------start------------->8---
\ProvidesPackage{fulllabel}
  [2019/09/08 v1.0 Support for fulllabel's]
\RequirePackage{hyperref}
\newcommand*{\fullref}[1]{%
  \hyperref[{#1}]{\autoref*{#1} (\nameref*{#1})}%
}
\endinput
--8<---------------cut here---------------end--------------->8---

and a fulllabel.el which looks like this:

--8<---------------cut here---------------start------------->8---
(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)
--8<---------------cut here---------------end--------------->8---

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?

Best, Arash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]