While further trying to set up a Latex environment in emacs I stumbled over a "problem" with macro-completion which I don't understand right now.

When writing Latex code the usual way to invoke macro insertion in the mini buffer is C+c, RET, then enter the macro name (using TAB to complete). Afterwards AUCTeX asks me for entering optional arguments, mandatory arguments, labels etc. This works quite good and is really catchy compared to other editors. It even works for xparse commands and self-defined macros after parsing the particular packages/infos.

But incomprehensibly there seem to be some very fundamental macros missing on my emacs. E.g. when trying to add a \section using the described mechanism, I hit C+c, RET; then enter sec, hit TAB for auto-completion. But it directly completes to \sectionmark stating [Sole Completion]; same for subsection etc. and also for some commands like \textbf. For other Latex-commands it works like expected.

If run LaTeX-section manually from the mini buffer,it asks me for level, title etc. but inserts a wrong command wich has level as verbatim command name not the expected "level". E.g. \1{title} instead of \section{title}. Thus, AUCTeX seems to be missing something.

The only packages I've installed besides AUCTeX are auto-completion-auctex and its dependencies (auto-complete, popup, yasnippet). But the problem was already present before installing the completion packages.

My .emacs is also very reasonable:

 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages '(auto-complete-auctex auctex)))
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(setq TeX-parse-self t) ; Enable parse on load.
(setq TeX-auto-save t) ; Enable parse on save.
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)

;; parse xparse by default
(add-hook 'LaTeX-mode-hook 'my/LaTeX-mode-setup)
(defun my/LaTeX-mode-setup ()
  (TeX-run-style-hooks "xparse"

I may be missing something obvious since I'm still very new to emacs. Searching online, I couldn't find a similar problem, so far.

  • 1
    Indeed, the usual way to add a section is LaTeX-section (thus you don't get them at C-c RET, btw, it is bound to C-c C-s by default), but you seem to be doing something wrong there. The "level" expected by the arguments reading is not a number, but some typical values offered by completion, like "section", "chapter" etc. Try hitting TAB to get completion values.
    – gusbrs
    Commented Oct 9, 2023 at 14:51
  • For \textbf and friends, see TeX-font / C-c C-f.
    – gusbrs
    Commented Oct 9, 2023 at 14:53
  • Btw, as far as I can tell, auto-completion-auctex is not related to the problem, and I don't see why you need it. If I understand correctly, it would be an alternative to company or corfu, and you'd probably get better results with either.
    – gusbrs
    Commented Oct 9, 2023 at 14:55
  • Another tip, for the case of LaTeX-section and the wrong input. You say you are new to Emacs, and it appears you are still not well acquainted with how completion works. You may want to check some completion framework which gives you a more intuitive UI. Usual suspects are: Vertico, Ivy, Helm, Fido, etc. Plenty to choose from.
    – gusbrs
    Commented Oct 9, 2023 at 14:59
  • Another comment, I don't think you need (or should...) add "latex" to TeX-run-style-hooks there. ;-)
    – gusbrs
    Commented Oct 9, 2023 at 15:18

1 Answer 1


As already explained by @gusbrs it was a typically beginners mistake. I was sure that every LaTeX macro could be invoked with C-c, RET (and am still convinced that this would be less confusing).

Now I know I need C-c, C-s for a section.

  • This is by design: C-u has different meanings when supplied to C-c RET, C-c C-s and font-related bindings like C-c C-f C-t. Check AUCTeX's manual for details. Commented Oct 13, 2023 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.