12.5.3 Using CDLaTeX to enter math

CDLaTeX mode is a minor mode that is normally used in combination with a major LaTeX mode like AUCTeX in order to speed-up insertion of environments and math templates. Inside Org mode, you can make use of some of the features of CDLaTeX mode. You need to install ‘cdlatex.el’ and ‘texmathp.el’ (the latter comes also with AUCTeX) from NonGNU ELPA with the Emacs packaging system or alternatively from https://staff.fnwi.uva.nl/c.dominik/Tools/cdlatex/. Do not use CDLaTeX mode itself under Org mode, but use the special version Org CDLaTeX minor mode that comes as part of Org. Turn it on for the current buffer with M-x org-cdlatex-mode, or for all Org files with

(add-hook 'org-mode-hook #'turn-on-org-cdlatex)

When this mode is enabled, the following features are present (for more details see the documentation of CDLaTeX mode):

C-c {

Insert an environment template.

TAB

The TAB key expands the template if point is inside a LaTeX fragment114. For example, TAB expands ‘fr’ to ‘\frac{}{}’ and position point correctly inside the first brace. Another TAB gets you into the second brace.

Even outside fragments, TAB expands environment abbreviations at the beginning of a line. For example, if you write ‘equ’ at the beginning of a line and press TAB, this abbreviation is expanded to an ‘equation’ environment. To get a list of all abbreviations, type M-x cdlatex-command-help.

^
_

Pressing _ and ^ inside a LaTeX fragment inserts these characters together with a pair of braces. If you use TAB to move out of the braces, and if the braces surround only a single character or macro, they are removed again (depending on the variable cdlatex-simplify-sub-super-scripts).

`

Pressing the backquote followed by a character inserts math macros, also outside LaTeX fragments. If you wait more than 1.5 seconds after the backquote, a help window pops up.

'

Pressing the single-quote followed by another character modifies the LaTeX symbol before point with an accent or a font. If you wait more than 1.5 seconds after the single-quote, a help window pops up. Character modification works only inside LaTeX fragments; outside the quote is normal.


Footnotes

(114)

Org mode has a method to test if point is inside such a fragment, see the documentation of the function org-inside-LaTeX-fragment-p.