emacs-devel
[Top][All Lists]
Advanced

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

Re: address@hidden: tex-mode: too many _ (underscores) interpreted as su


From: Ralf Angeli
Subject: Re: address@hidden: tex-mode: too many _ (underscores) interpreted as subscripts]
Date: Tue, 05 Oct 2004 11:56:03 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

* Richard Stallman (2004-10-04) writes:

>     If this should be fixed for arbitrary LaTeX commands which are not
>     fontified, one would have to check if the underscores in concern are
>     located inside of math environments.
>
> \nolinkurl and \url are not related to math.  Is there an intermediate
> possibility, one that doesn't check specifically for math
> environments, but handles all the constructs that are not related to
> math?

None I know of.

Unescaped underscores can be used in a variety of places; in labels,
references, verbatim commands/environments, math commands/environments
etc.  The current implementation searches for occurences of unescaped
underscores in the buffer and checks for the presence of certain
faces.  If it finds e.g. `tex-verbatim-face', it knows that there is
no math-related content and skips this occurence.  If there is no such
face, it assumes that it is inside of a math command or environment
and fontifies the stuff after the underscore.  This may cause false
fontifications.

If the code wanted to check if the (unfontified) underscore at hand is
part of math content it would have to search for constructs starting
or ending math (that's what `texmathp' does).  So for each underscore
you could end up scanning a large part of the buffer.  A way out of
this could be to scan the buffer linearly from start to end and stop
only at math-related content for the fontification of subscripts and
superscripts.  (Of course, for JIT fontification one would have to
look upwards in the buffer when fontification starts.)

> Meanwhile, why is texmathp so slow?

-- 
Ralf





reply via email to

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