auctex
[Top][All Lists]
Advanced

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

Re: key-val label style


From: Wierdl Máté
Subject: Re: key-val label style
Date: Fri, 18 Sep 2020 17:05:41 -0500

Well, it all worked once.  When I closed the latex file and later this afternoon reopened it in Emacs, it didn't see the key-val labels and auctex wouldn't enter my theoremlike environments with key-val labels.

I'll make up a small working example and I'll send my .emacs file.

Máté

On Fri, Sep 18, 2020 at 10:56 AM Wierdl Máté <wierdlmate@gmail.com> wrote:
I think at stackexchange the file you gave was the same.  The possible difference hence is the installation of the newer auctex?



On Fri, Sep 18, 2020 at 10:48 AM Wierdl Máté <wierdlmate@gmail.com> wrote:
Arash,

This is fantastic.  I installed the new auctex via elpa and your style file, and now when I enter a tcolorbox environment, I get the keyval labels added automatically.  I also see the references when I do C-c ).

I'll report back if I see any bugs but I am happy!

The answer you gave me a while back in stack exchange was only partially working, but now this is all good. Maybe you want to update there?


Thx,  bro,

Máté

On Fri, Sep 18, 2020 at 5:17 AM Arash Esbati <arash@gnu.org> wrote:
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

reply via email to

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