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 f`LaTeX-math-mode`

RET):Thus,

C-u ` tinsertsIf 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 inside`LaTeX-math-initialize`

, in`latex.el`

.