auctex-devel
[Top][All Lists]
Advanced

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

Re: problems with thmstools (and automatic insertion of labels (reftex)


From: Arash Esbati
Subject: Re: problems with thmstools (and automatic insertion of labels (reftex)
Date: Sat, 25 Mar 2023 22:26:38 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Hi Uwe,

Uwe Brauer <oub@mat.ucm.es> writes:

> I have to work with a file that uses thmtools (which is not supported by
> auctex, as far as I can tell,

http://git.savannah.gnu.org/cgit/auctex.git/tree/style/thmtools.el

is available since 2018.

> nor by reftex)

RefTeX support OOTB isn't feasible since all environments are defined by
the user.

> I now run  LaTeX-environment and now something strange happens
>
> The minibuffer offers me
> heading (h) key=val (k)  Empty (RET)
>
> Now, RET does not work, nothing happens,

RET does work, it just leave the optional argument empty.

> h leads to a heading (title) which is ok, but then no label is
> inserted as I am used to by
> (setq reftex-label-alist
>       ("cor" ?C "cor:%f:" "~\\ref{%s}" t
>       ("Corollary" "Cor."  "C.")))

Note that the setting above cannot work.  `reftex-label-alist' is an
alist, so you have to do:

(setq reftex-label-alist
      '(("cor" ?C "cor:%f:" "~\\ref{%s}" t ("Corollary" "Cor."  "C."))))

And finally, in order to get a label inserted automatically, you have to
set `LaTeX-label-alist' *and* `reftex-label-alist':

(add-to-list 'LaTeX-label-alist '("cor" . "cor:"))
(setq reftex-label-alist
      '(("cor" ?C "cor:%f:" "~\\ref{%s}" t
        ("Corollary" "Cor."  "C."))))

And then AUCTeX will delegate the generation of label to RefTeX.  I
think this is also documented in thmtools.el, amsthm.el, ntheorem.el
etc.

> And 
>
> (defun LaTeX-cor-insert (environment) ;Version:1.20
>         (if (y-or-n-p
>                  (format "Do you want a title "))
>                 (let ((title (read-string "(optional) Title: ")))
>                   (LaTeX-insert-environment "cor" (concat "[" title "]"))
>                   (and (LaTeX-label environment)
>                            (newline-and-indent)))
>           (LaTeX-insert-environment "cor")
>           (and (LaTeX-label environment)
>                    (newline-and-indent))))

Why do you need this function?  thmtools.el provides
`LaTeX-thmtools-env-label' which does the job after parsing the
document.

Best, Arash



reply via email to

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