GNU Emacs
Emacs
Dashboard

25.11.2 LaTeX Editing Commands

LaTeX mode provides 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’ tags are used to group blocks of text. To insert a block, type C-c C-o ( tex-latex-block). This prompts for a block type, and inserts the appropriate matching ‘ \begin’ and ‘ \end’ tags, leaving a blank line between the two and moving point there.

When entering the block type argument to C-c C-o, you can use the usual completion commands (see Completion). The default completion list contains the standard LaTeX block types. If you want additional block types for completion, customize the list variable latex-block-names.

In LaTeX input, ‘ \begin’ and ‘ \end’ tags must balance. You can use C-c C-e ( tex-close-latex-block) to insert an ‘ \end’ tag which matches the last unmatched ‘ \begin’. It also indents the ‘ \end’ to match the corresponding ‘ \begin’, and inserts a newline after the ‘ \end’ tag if point is at the beginning of a line. The minor mode latex-electric-env-pair-mode automatically inserts an ‘ \end’ or ‘ \begin’ tag for you when you type the corresponding one.