[TxMt] Re: Latex Equation Highlighting
Charilaos Skiadas
skiadas at hanover.edu
Thu Oct 26 14:11:39 UTC 2006
On Oct 26, 2006, at 2:37 AM, Jacob Rus wrote:
> William Yang wrote:
>> A little quirk with the Latex equation highlighting: if you use an
>> equation environment like \begin{equation} or \begin{multline},
>> everything inside of the \begin \end is highlighted as an
>> equation, even \label{} definitions. Shouldn't things like \label
>> not be colored like the equation? What do you all thing?
>
> This just means that the grammar isn't complex enough, and doesn't
> know about \label{} yet. It's easy to change that, and I'm sure
> that Haris would be glad to accept a patch that fixes it...
The grammar knows about label, I think (addendum: looking at it
again, it doesn't, hence part 1 below), just not inside math
environment. In any case, even if we mark the label differently, it
is still marked *also* as math. There are a number of ways of doing
things, both involving the same first step:
1. Create a new rule in the *repository* to match the \label{...}
syntax.
2a. Include that rule in both the LaTeX and the TeX Math bundles.
Not, perfect because this is not a TeX command, it is a LaTeX command.
2b. Include the rule only in the text.tex.latex language, and alter
the math environments rules so that they also include it. A bit
better than 2a, but the label is still treated also as math.
2c. Include the rule only in the text.tex.latex language, and also
change the begin match of the math environments, to include a
potential \label argument. This restricts the label to be the first
non-whitespace thing after the \begin{equation}, which is perhaps ok,
but I guess not ok for multiline environments with different labels
for each line. Also, this requires defining some things in multiple
places, not a wise thing in general.
I'm not entirely crazy about any of these options, though I would say
2b is probably the best from them. And as Jacob said, I welcome patches.
> -Jacob Rus
Haris
More information about the textmate
mailing list