I've been facing some trouble with math symbol insertion in AUCTeX and I'm probably missing something from the available structure and options. But as I'm struggling for a while, I might as well ask.

I know LaTeX-math-mode, I enable it, and I (think I) know how it is supposed to work. However, I'm in a sort of middle ground, as I don't use math heavily, so that the bindings beyond LaTeX-math-abbrev-prefix don't really stick, but I do need it sometimes. Besides, many (most?) symbols in LaTeX-math-default have their binding set to nil.

I also know that, failing the binding I can recur to the menu LaTeX-math-mode provides. But I don't find menus very convenient in general, and prefer to avoid them, if at all possible.

I yet know that completion (with "C-M-i", aka "poor man's M-TAB") works in math mode. Which helps already, if I happen to know how the command starts. But, suppose I want to choose among any number of arrows...

So, as far as I can grasp, the insertion of math symbols from the set LaTeX-math-default and LaTeX-math-list will depend either, on the binding following the math-prefix (if there is one), on completion with "C-M-i" or, as a last resource, on the menu.

Still, I would expect to find the items of LaTeX-math-default and LaTeX-math-list available among the items of TeX-insert-macro (the usual C-c RET), but they don't seem to be available there. Which I find curious, since, e.g. the style file for "amssymb" includes it's items in the TeX-add-symbols section. So, if I load amssymb, I will find \upharpoonright available with TeX-insert-macro, but not \ldots or \sum.

Is this expected behavior? Am I missing something? Are those symbols not available there because they are not supposed to be there, as there is a better way to reach them? Is there a configuration that I've missed to make them available there?

Finally, if my expectation is not unreasonable, how could I properly include the items in LaTeX-math-default and LaTeX-math-list among the candidates of TeX-insert-macro?

Some relevant items in my AUCTeX configuration (under use-package):

:hook (LaTeX-mode . LaTeX-math-mode)
(TeX-auto-save t)
(TeX-parse-self t)
(TeX-complete-expert-commands t)
(TeX-insert-macro-default-style (quote mandatory-args-only))
(LaTeX-math-abbrev-prefix "C-$")
(TeX-electric-math (cons "\\(" "\\)"))

Environment: AUCTeX 12.1.2, Emacs 26.2

1 Answer 1


Well, I've made some progress on this and I might as well share.

The LaTeX default math symbols contained in LaTeX-math-default really seem not to be loaded to the completion list of TeX-insert-macro by default. I haven't followed the code in detail, but I have tested it with emacs -Q.

This indeed seems to be by design, out of the concern not to bloat the completion lists of TeX-insert-macro. (This thread suggests this concern exists).

Now, I personally think this concern is more relevant in the context of the default completion framework, but less so if you happen to use some other completion framework, such as ivy or helm, which can deal better with a larger number of candidates (not unlimited though, of course).

I haven't found any standard way to include the items in LaTeX-math-default and LaTeX-math-list to TeX-symbol-list which is used to generate candidates by TeX-insert-macro.

But I did it with:

;; Math mode is nice, but it would be nicer to have math symbol completion
;; with 'TeX-insert-symbol' ("C-c RET").  I’m probably missing something,
;; but this should work until I learn the proper way to do it.
(defun my/auctex-add-math-to-TeX-symbol-list ()
  "Add math symbols in `LaTeX-math-default' to `TeX-symbol-list'.
Also those eventually in `LaTeX-math-list'. "
  (apply 'TeX-add-symbols
         (seq-filter 'stringp
                     (append (mapcar #'cadr LaTeX-math-list)
                             (mapcar #'cadr LaTeX-math-default)))))

(add-hook 'LaTeX-mode-hook #'my/auctex-add-math-to-TeX-symbol-list)

There it is, in case someone else also thinks this is an interesting approach.

You must log in to answer this question.

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