[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

30.9.1 TeX Editing Commands

Here are the special commands provided in TeX mode for editing the text of the file.

"

Insert, according to context, either ‘``’ or ‘"’ or ‘''’ (tex-insert-quote).

C-j

Insert a paragraph break (two newlines) and check the previous paragraph for unbalanced braces or dollar signs (tex-terminate-paragraph).

M-x tex-validate-region

Check each paragraph in the region for unbalanced braces or dollar signs.

C-c {

Insert ‘{}’ and position point between them (tex-insert-braces).

C-c }

Move forward past the next unmatched close brace (up-list).

In TeX, the character ‘"’ is not normally used; we use ‘``’ to start a quotation and ‘''’ to end one. To make editing easier under this formatting convention, TeX mode overrides the normal meaning of the key " with a command that inserts a pair of single-quotes or backquotes (tex-insert-quote). To be precise, this command inserts ‘``’ after whitespace or an open brace, ‘"’ after a backslash, and ‘''’ after any other character.

If you need the character ‘"’ itself in unusual contexts, use C-q to insert it. Also, " with a numeric argument always inserts that number of ‘"’ characters. You can turn off the feature of " expansion by eliminating that binding in the local map (voir la section Customizing Key Bindings).

In TeX mode, ‘$’ has a special syntax code which attempts to understand the way TeX math mode delimiters match. When you insert a ‘$’ that is meant to exit math mode, the position of the matching ‘$’ that entered math mode is displayed for a second. This is the same feature that displays the open brace that matches a close brace that is inserted. However, there is no way to tell whether a ‘$’ enters math mode or leaves it; so when you insert a ‘$’ that enters math mode, the previous ‘$’ position is shown as if it were a match, even though they are actually unrelated.

TeX uses braces as delimiters that must match. Some users prefer to keep braces balanced at all times, rather than inserting them singly. Use C-c { (tex-insert-braces) to insert a pair of braces. It leaves point between the two braces so you can insert the text that belongs inside. Afterward, use the command C-c } (up-list) to move forward past the close brace.

There are two commands for checking the matching of braces. C-j (tex-terminate-paragraph) checks the paragraph before point, and inserts two newlines to start a new paragraph. It outputs a message in the echo area if any mismatch is found. M-x tex-validate-region checks a region, paragraph by paragraph. The errors are listed in the ‘*Occur*’ buffer, and you can use C-c C-c or Mouse-2 in that buffer to go to a particular mismatch.

Note that Emacs commands count square brackets and parentheses in TeX mode, not just braces. This is not strictly correct for the purpose of checking TeX syntax. However, parentheses and square brackets are likely to be used in text as matching delimiters and it is useful for the various motion commands and automatic match display to work with them.


[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

Ce document a été généré par Eric Reinbold le 23 Février 2009 en utilisant texi2html 1.78.