2.5 Entering Mathematics
TeX is written by a mathematician, and has always contained good support for formatting mathematical text. AUCTeX supports this tradition, by offering a special minor mode for entering text with many mathematical symbols. You can enter this mode by typing C-c ~
.
command
LaTeX-math-mode​
(C-c ~
) Toggle LaTeX Math mode. This is a minor mode rebinding the key LaTeX-math-abbrev-prefix
to allow easy typing of mathematical symbols. `
will read a character from the keyboard, and insert the symbol as specified in LaTeX-math-default
and LaTeX-math-list
. If given a prefix argument, the symbol will be surrounded by dollar signs.
You can use another prefix key (instead of `
) by setting the variable LaTeX-math-abbrev-prefix
.
To enable LaTeX Math mode by default, add the following in your ‘.emacs
’ file:
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
user option
LaTeX-math-abbrev-prefix​
A string containing the prefix of LaTeX-math-mode
commands; This value defaults to `
.
The string has to be a key or key sequence in a format understood by the kbd
macro. This corresponds to the syntax usually used in the manuals for Emacs Emacs Lisp.
The variable LaTeX-math-list
allows you to add your own mappings.
user option
LaTeX-math-list​
A list containing user-defined keys and commands to be used in LaTeX Math mode. Each entry should be a list of two to four elements.
First, the key to be used after LaTeX-math-abbrev-prefix
for macro insertion. If it is nil, the symbol has no associated keystroke (it is available in the menu, though).
Second, a string representing the name of the macro (without a leading backslash.)
Third, a string representing the name of a submenu the command should be added to. Use a list of strings in case of nested menus.
Fourth, the position of a Unicode character to be displayed in the menu alongside the macro name. This is an integer value.
user option
LaTeX-math-menu-unicode​
Whether the LaTeX menu should try using Unicode for effect. Your Emacs built must be able to display include Unicode characters in menus for this feature.
AUCTeX’s reference card ‘tex-ref.tex
’ includes a list of all math mode commands.
AUCTeX can help you write subscripts and superscripts in math constructs by automatically inserting a pair of braces after typing ﹤_﹥ or ﹤^﹥ respectively and putting point between the braces. In order to enable this feature, set the variable TeX-electric-sub-and-superscript
to a non-nil value.
user option
TeX-electric-sub-and-superscript​
If non-nil, insert braces after typing ﹤^﹥ and ﹤_﹥ in math mode.
You can automatically turn off input methods, used to input non-ascii characters, when you begin to enter math constructs.
user option
TeX-math-input-method-off-regexp​
Input method matching this regular expression is turned off when $
is typed to begin math mode or a math environment is inserted by C-c C-e
(LaTeX-environment
).