>
> Hi Uwe,
>
> Maybe I'm missing something but you can do 'C-c C-m autoref RET' and
> AUCTeX will handover the label query to RefTeX, given that hyperref.el
> and nameref.el are loaded.  You don't like that?
>

I Arash, I rather explained that poorly. 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
(TeX-add-style-hook
 "fulllabel"
 (lambda ()

   (TeX-add-symbols
    '("fulllabel"     TeX-arg-define-label)
    '("fulllonglabel" TeX-arg-define-label)
    '("fullref"       TeX-arg-ref))

   ;; Tell AUCTeX about the macros
   (TeX-auto-add-regexp
    '("\\\\full\\(?:long\\)?label{\\([^\n\r%\\{}]+\\)}" 1 LaTeX-auto-label))

   ;; Check if reftex-vars.el is loaded:
   (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")))

   ;; Fontification
   (when (and (featurep 'font-latex)
              (eq TeX-install-font-lock 'font-latex-setup))
     (font-latex-add-keywords '(("fulllabel"     "{")
                                ("fulllonglabel" "{")
                                ("fullref"       "{"))
                              'reference)))
 TeX-dialect)

;;; fulllabel.el ends here

\ProvidesPackage{fulllabel}
  [2019/09/08 v1.0 Support for fulllabel's]
\let\fulllabel\label
\let\fullref\ref
\renewcommand*{\fullref}[1]{\hyperref[{#1}]{\autoref*{#1} (\nameref*{#1})}}
\endinput

Reply via email to