auctex
[Top][All Lists]
Advanced

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

Re: key-val label style


From: Arash Esbati
Subject: Re: key-val label style
Date: Fri, 18 Sep 2020 12:17:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50

Hi Máté,

Wierdl Máté <wierdlmate@gmail.com> writes:

> I am using the tcolorbox latex package which doesn't use the usual '\label'
> command.  Instead, one has to specify a label  in key-val form as in
>
> \begin{thm}[label={thm:1}]{}{}
>   $1=2/2$
> \end{thm}
>
> Is there a way to have reftex/auctex work with this variation?

AUCTeX/RefTeX were designed for vanilla LaTeX.  Additional packages are
supported via style files (within AUCTeX) and customization in RefTeX.
key-val labels are possible, but with some limitations (see below).

> What I mean is this
>
> 1) reftex keeps track of these as labels and  when I want to reference this
> theorem, 'C-c )' will show this to me.

You can add your environment to `reftex-label-regexps' in order to tell
RefTeX about `thm'.  But the regexp is somewhat complicated.

> (Until today, this was working fine, but now reftex doesn't recognize
> this form of a label.  I have no idea what happened, what's changed. )

Which version of Emacs are you using?  Have you updated to 27.1?
RefTeX's handling of key-val labels was changed there.

> 2) auctex/reftex enters a label in this key-val form when I do 'C-c ('.

You can teach AUCTeX to insert a key-val label when you insert the
environment with `C-c C-e ENV RET'; hitting `C-c (' in an environment
doesn't work.

> 3) the "renumber simple labels" function works with such references.

This is indeed a missing feature in RefTeX.  I never really looked how
RefTeX does this, hence I can't help.

Long time ago, I started writing a support file for tcolorbox's theorems
library.  That unfinished work is attached.  Set the variable
`TeX-style-private' to a directory of your choice, e.g.:

    (setq TeX-style-private
          (expand-file-name "~/.emacs.d/auctex-style"))

save the file there and open your .tex file.  Also hit `C-c C-n' to
parse your document.  Maybe you can report back if it works.

Best, Arash

Attachment: tcolorboxlib-theorems.el.gz
Description: Binary data


reply via email to

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