Next: , Previous: TeX Editing, Up: TeX Mode


30.9.2 LaTeX Editing Commands

LaTeX mode, and its variant, SliTeX mode, provide a few extra features not applicable to plain TeX.

C-c C-o
Insert ‘\begin’ and ‘\end’ for LaTeX block and position point on a line between them (tex-latex-block).
C-c C-e
Close the innermost LaTeX block not yet closed (tex-close-latex-block).

In LaTeX input, ‘\begin’ and ‘\end’ commands are used to group blocks of text. To insert a ‘\begin’ and a matching ‘\end’ (on a new line following the ‘\begin’), use C-c C-o (tex-latex-block). A blank line is inserted between the two, and point is left there. You can use completion when you enter the block type; to specify additional block type names beyond the standard list, set the variable latex-block-names. For example, here's how to add ‘theorem’, ‘corollary’, and ‘proof’:

     (setq latex-block-names '("theorem" "corollary" "proof"))

In LaTeX input, ‘\begin’ and ‘\end’ commands must balance. You can use C-c C-e (tex-close-latex-block) to insert automatically a matching ‘\end’ to match the last unmatched ‘\begin’. It indents the ‘\end’ to match the corresponding ‘\begin’. It inserts a newline after ‘\end’ if point is at the beginning of a line.