2

Similar questions have been asked before so this post may be a duplicate of:

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 in hvw-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.

Any help with this is highly appreciated.

3
  • Which AUCTeX version are you using? Maybe 13.0.15 from ELPA? Commented Jan 10, 2022 at 15:35
  • Yes, indeed, I'm using version 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? Commented Jan 11, 2022 at 20:05
  • Huh. The most confusing aspect of my problem - partial macro completion of siunitx - has resolved on its own. I am still using auctex 13.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 as algorithm2e, optidef, etc. I will once again check out the advice given in other posts. Commented Jan 25, 2022 at 12:40

1 Answer 1

2

AUCTeX 13.0.15 introduced some changes which might be relevant for the issues you're facing. For the easy part:

  • 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.
    This is due to premature removal of deprecated macros. This is fixed in version 13.0.16 which is already released.

  • for the algorithm2e package, no completion is provided at all
    AUCTeX relies on its own style files in order to provide completion. You can have a look for them in this directory. There are currently no algorithm2e.el or optidef.el.

For this part:

  • Inserting my custom macros via TeX-insert-{macro|environment} used to work until recently and now it no longer works at all.
    It is hard to tell if a change in xparse.el is relevant. Maybe you open up a new question showing the content of your hvw-macros.el and then try to find out what's going wrong.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .