Similar questions have been asked before so this post may be a duplicate of:
- How to properly set up AUCTeX to parse macros from my own *.sty files?
- auctex does not parse own style file
- Adding custom macros to completion list with AUCTeX
I have tried to follow the advice given in the posts linked above, and had partially working support for my custom macros - but now something in my AucTeX setup appears to be broken and I am reaching out for help.
My setup is the following:
I use Emacs 27.2 with AucTeX 13.0.15. In my TEXMFHOME
directory, there is a subfolder (~/texmf/tex/latex/local/hvw
) containing the following style file hvw.sty
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{hvw}[2021/12/14 package hvw]
\input{hvw-packages.tex}
\input{hvw-macros.tex}
% ...
\endinput
, as well as several .tex
files containing packages, macros, colors, etc.
The file hvw-packages.tex
contains packages to be loaded
\RequirePackage{xparse}
\RequirePackage{amsmath}
\RequirePackage{hyperref}
\RequirePackage{siunitx}
\RequirePackage{algorithm2e}
% ...
whereas hvw-macros.tex
contains some custom macros:
\DeclareDocumentCommand\email{m}{\href{mailto:#1}{\textcolor{rwth-blue}{\texttt{#1}}}}
\DeclareDocumentCommand\setdef{mo}{\left\{#1\IfNoValueTF{#2}{}{ \mid #2}\right\}}
% ...
In my init.el
, I have set the following variables:
(use-package tex
:ensure auctex
:init
(setq-default TeX-master nil)
; ...
:custom
(TeX-auto-save t)
(TeX-parse-self t)
(TeX-macro-private '("./"
"~/texmf/tex/latex/local/hvw"))
; ...
)
I have also run TeX-auto-generate
multiple times on ~/texmf/tex/latex/local/
, and I can see its output in my TeX-auto-private
directory ... but if open a .tex
document with \usepackage{hvw}
in the preamble:
- Inserting my custom macros via
TeX-insert-{macro|environment}
used to work until recently and now it no longer works at all. - Inserting macros or environments via
TeX-insert-{macro|environment}
only works for some of the packages listed inhvw-packages.tex
:- for the
amsmath
package, everything seems to be fine. - for
siunitx
, I only get some of the macros as completion candidates, namely\sisetup
,\DeclareSI{Unit|Power|Prefix|Qualifier}
. The more common macros\SI
and\si
are now missing which is extremely confusing to me. - for the
algorithm2e
package, no completion is provided at all.
- for the
Any help with this is highly appreciated.
13.0.15
. (I could have sworn that I had included that info in my original post ... have added it now). Is this a known issue?siunitx
- has resolved on its own. I am still using auctex13.0.15
so I cannot really point out the reason but I won't complain. For my remaining issues - no completion for candidates for custom macros - no completion for some latex packages, such asalgorithm2e
,optidef
, etc. I will once again check out the advice given in other posts.