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

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

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


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

tex-validate-region (and therefore also tex-validate-buffer) reports
false errors for some LaTeX commands.

To reproduce the bug, first make a .tex file containing the following
lines:

-----------------------
\documentclass{article}
\begin{document}
The equation
\(
  e = mc^2
\)
is very famous.
\end{document}
-----------------------

Then visit this file (in LaTeX mode).  Then type “M-x
tex-validate-buffer”.

The correct behavior on this example would be to report “No mismatches
found”.  The buggy actual behavior is that Emacs reports “1 mismatch
found” and lists the (incorrectly diagnosed) mismatch in an *Occur*
buffer.

The cause of the problem is that the code in tex-validate-region
searches for open parentheses, positions point right in front of each
open parenthesis, and then tries to do forward-sexp.  This doesn't
work for the “(” in “\(”, because the matching close parenthesis is
preceded by a backslash.

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.

I hope this report is helpful.

Joe

======================================================================
In GNU Emacs 22.1.1 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2007-06-27 on artemis
Windowing system distributor `The X.Org Foundation', version 11.0.70000000
configured using `configure  '--prefix=/home/jbw/local2' '--enable-debug' 
'--disable-nls' '--with-x-toolkit=gtk' 'CFLAGS=-O0 -g3 -ggdb''




reply via email to

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