bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tex-validate-region reports false errors on some LaTeX commands


From: Joe Wells
Subject: Re: tex-validate-region reports false errors on some LaTeX commands
Date: Sun, 09 Sep 2007 11:39:34 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

martin rudalics <rudalics@gmx.at> writes:

>> The easy fix is to simply ignore open parentheses (also open square
>> brackets) that are preceded by a backslash.  If things are fixed this
>> way, then mismatched uses of \(, \), \[, and \] will not be diagnosed,
>> but that is better than reporting zillions of false errors.
>
> We could give the backslash before paren style characters some
> syntax-table property (punctuation?).  We'd match "\(" with ")" then.
> Would that harm much?

The correct solution would require that \(, \), \[, and \] are treated
the same as \begin{math}, \end{math}, \begin{displaymath}, and
\end{displaymath}.  (The latter are defined in terms of the former in
latex.ltx.)  Emacs already parses \begin{XYZ} and \end{XYZ} for use in
forward-sexp.

Anyway, the code in tex-validate-region seems to operate in two
passes.  The first pass verifies that the syntax parsing underlying
forward-sexp is happy.  The second pass seems to be oriented at making
ordinary parentheses/brackets/braces match.  I'm not entirely sure why
two passes should be needed.  Can anyone explain?

Note that strange things happen with syntax parsing in LaTeX.
Consider this text:

  (\begin{quote})
  \end{quote}

If you put point to the left of the “(”, then forward-sexp moves to
the right of the “)”.  If you put point before the \begin{quote}, then
forward-sexp moves to the right of the \end{quote}.  This all happens
despite the fact that the structures are not balanced properly.  Can
anyone explain this bizarreness?

-- 
Joe




reply via email to

[Prev in Thread] Current Thread [Next in Thread]