[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problems with thmstools (and automatic insertion of labels (reftex)
From: |
Uwe Brauer |
Subject: |
Re: problems with thmstools (and automatic insertion of labels (reftex) |
Date: |
Mon, 27 Mar 2023 12:15:04 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
>>> "AE" == Arash Esbati <arash@gnu.org> writes:
> Uwe Brauer <oub@mat.ucm.es> writes:
>> In a moment because right now I have a more pressing problem:
>>
>> I put
>> (add-to-list 'LaTeX-label-alist '("cor" . "cor:"))
> This should also go into a hook, but I think you really should solve
> this differently.
>> To my reftex_init file, because it is then more convenient to
>> configure the labels.
>>
>> I load the reftex_init file from my auctex_init file
>>
>> Like this
>>
>>
>> ,----
>> | (load "auctex.el" nil t t)
>> | (load "preview-latex.el" nil t t)
>> |
>> | (require 'tex-site)
> ^^^^^^^^^^^^^^^^^^
> Don't do this; (load "auctex.el" nil t t) is sufficient.
>> In my reftex_init file I have added
>> (add-to-list 'LaTeX-label-alist '("cor" . "cor:"))
>>
>> However when restarting emacs I obtain the following error, I attach.
>>
>> Since this label is defined in auctex's latex.el
>>
>> I thought
>> (require 'latex)
>>
>> In my reftex_init file would solve the issue but it did not. I could
>> try out an explicit load-file command, but I presume there are more
>> elegant solutions.
> I strongly suggest that you write a small LaTeX package
> ub-thmtools-envs.sty like this and put it where TeX can find it:
> \ProvidesPackage{ub-thmtools-envs}[2023/03/27 v1.0]
> \RequirePackage{thmtools}
> \declaretheorem{cor}[%
> name=Corollary,
> Refname={Corollary,Corollaries},
> numberwithin=section
> ]
> \declaretheorem{lem}[%
> name=Lemma,
> Refname={Lemma,Lemmas},
> numberwithin=section
> ]
> \declaretheorem{prop}[%
> name=Proposition,
> Refname={Proposition,Proposition},
> numberwithin=section
> ]
> \declaretheorem{thm}[%
> name=Theorem,
> Refname={Theorem,Theorems},
> numberwithin=section
> ]
> % ...
> \endinput
> Also write the corresponding AUCTeX style file ub-thmtools-envs.el and
> put it where AUCTeX can find it:
> (TeX-add-style-hook
> "ub-thmtools-envs"
> (lambda ()
> (TeX-run-style-hooks "thmtools")
> ;; Tell AUCTeX
> (let ((envs '(("cor" . "cor")
> ("lem" . "lem")
> ("prop" . "prop")
> ("thm" . "thm"))))
> (dolist (env envs)
> (LaTeX-add-thmtools-declaretheorems env)
> (add-to-list 'LaTeX-label-list env t)))
> ;; Tell RefTeX
> (when (fboundp 'reftex-add-label-environments)
> (reftex-add-label-environments
> '(("cor" ?C "cor:%f:" "~\\ref{%s}" t ("Corollary" "Cor." "C."))))) ))
> Now you can get rid of all the hassle with your init setup and just
> write this in your .tex file:
> \usepackage{ub-thmtools-envs}
> and you should be just fine, assuming that you have paring enabled. It
> is much more maintainable than having all the stuff somewhere in you
> init process.
Thanks, I will think about it, it could also be a solution for amthm,
which I normally use, but maybe I switch to thmtools.
> Best, Arash
--
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military.
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine.
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/
smime.p7s
Description: S/MIME cryptographic signature