The forward-sexp command in EMACS can be used to find the $ that closes an inline equation: if the point is before the $ that opens the equation, then forward-sexp moves the point after the closing $. This does the correct thing with nested equations: e.g., if the point is before $a + \text{b $c$}$, then forward-sexp moves the point past the entire equation. Is there a way to find the \) or \] that closes a \( and \[ with auctex, perhaps with texmathp or font-latex-match-math-env? This seems to be a bit tricky in EMACS as there is no way to store multi-char delimiters in a syntax table.
Tell me more
×
TeX - LaTeX Stack Exchange is a question and answer site for
users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
|
|
||||
| show 1 more comment |
|
I have put together a function that might do what you want. It searches for the next LaTeX math delimiter –
To use it place it in your .emacs and run it by M-x Since I have just started to learn Lisp I am sure this code can improved in many ways. Please comment if you have any suggestions. |
|||||||||
|

$...$, as opposed to\(...\), is reliably robust in macro arguments and when written to files (i.e., table of contents), and\begin{equation*}...\end{equation*}(using amsmath package) is quite better visible. – user9588 Apr 19 '12 at 16:28\(and\)preferable to$? – N.N. Apr 21 '12 at 11:37\(\)\[\]. The theoretic gain of matched delimiters is not worth the price in editing support and loss of robustness in LaTeX. – user9588 Apr 22 '12 at 15:41fixltx2ewhich redefines them as robust. – N.N. Apr 22 '12 at 16:25$in LaTeX. I have some macros to quickly switch equations between inline and displayed that make critical use offorward-sexp. – Samuel Isaacson May 13 '12 at 18:05