In AUCTeX, you can enable a minor mode called LaTeX-math-mode
that instructs the prefix character `
to insert various common macros.
For example, ` t
inserts \tau@
when you are in a math environment (where @
is where point is left).
This is wonderful when you are in a math environment already.
However, I often refer to these symbols in the running text, and just doing the same ` t
inserts just \tau{}@
in text mode.
How can I instruct AUCTeX to, when in text mode, enter math mode like so: ` t
yields $\tau$@
?
Best Answer
Of course AUCTeX is already able to do this out of the box! From the description of
LaTeX-math-mode
(C-h fLaTeX-math-mode
RET):Thus, C-u ` t inserts
If you want to automatically wrap dollars around the symbol when in text mode without the prefix argument, add this to your
.emacs
:This redefines all
LaTeX-math-*
functions defined insideLaTeX-math-initialize
, inlatex.el
.