tex-insert-quote).
tex-terminate-paragraph).
tex-insert-braces).
up-list).
In TeX, the character ‘"’ is not normally used; instead,
quotations begin with ‘``’ and end with ‘''’. For
convenience, 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, it inserts
‘``’ after whitespace or an open brace, ‘"’ after a
backslash, and ‘''’ after any other character.
As a special exception, if you type " when the text before point is either ‘``’ or ‘''’, Emacs replaces that preceding text with a single ‘"’ character. You can therefore type "" to insert ‘"’, should you ever need to do so. (You can also use C-q " to insert this character.)
To disable the " expansion feature, eliminate that binding in the local map (see 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.
blog comments powered by Disqus