[TxMt] LaTeX diplaymath mode problems

Charilaos Skiadas cskiadas at uchicago.edu
Sun Nov 6 23:09:13 UTC 2005


Hi Brad,
On Nov 6, 2005, at 4:19 PM, Brad Miller wrote:

>
> On Nov 6, 2005, at 3:54 PM, Charilaos Skiadas wrote:
>
>> In other words, the two dollars signs next to each other are  
>> matched as the begining and end of a simple math mode, instead of  
>> being considered as the beginning of a block math mode. What makes  
>> it even weirder is that the following:
>> $$\int_{C_{t}}e^{g(z,t)}f(z,t)\d z$$ where $g,f$
>>
> I pasted your example above into the test.tex document and the text  
> between the $$ .. $$ is scoped as string.other.math.tex  The word  
> 'where' is scoped as text.latex and the g,f is scoped as  
> string.other.math.tex  I believe those are all correct yes?

> So, now I'm curious as to whats different between your document and  
> the test.tex document.
>
So in my case, if I put the cursor between the double dollar signs at  
the beginning, the scope is string.other.math.tex.
If I put it anywhere between that set of double dollar signs and the  
next one (supposed to be closing the math mode, it is not. This is  
what's wrong in my case.
If I put it between the second set of double dollar signs, it is  
string.other.math.block.tex.

I'll send you separately my file, see if that helps, but there's not  
anything weird about it I think.
> Is there a a reason to make the block math scope different than the  
> regular math scope?  It seems like it might be better to move the $ 
> $ into the TeX syntax file so that the contents of a block math  
> scope got the same treatment as an inline math math.tex scope?
>
If it is allowed in TeX, and I think it is, then yes it should  
probably be there. I think historically the difference was, IIRC,  
that the regular math mode was matched with a "match" regex, while  
the displaymath with a "begin"-"end" pair, hence they were different.  
I do believe they should be dealt with the same way if possible.
What happens in this case is that the first double dollar signs are  
matched with the regex from the TeX bundle:
         {    name = 'string.other.math.tex';
             begin = '\$';
             end = '\$';
             swallow = '\\\$';
             ...

On the other hand, the second double dollar signs are matched as the  
begin regex from the LaTeX bundle:
         {    name = 'string.other.math.block.latex';
             begin = '\$\$';
             end = '\$\$';
         },

and the parser goes on to search the entire rest of the document for  
the closing $$
So what confuses me (and this is what I meant when I asked how it was  
possible) is how only the first of these is matched by the  
string.other.math.tex regex, and not the second one as well. How can  
string.other.math.tex not take priority in both cases? Maybe Allan  
can answer that, but for right now I see the following possible  
solutions:
1) Make it so that the string.other.math.tex regex needs to match  
something between the
             begin = '\$';
             end = '\$';
Not sure if this is possible.
2) Move the string.other.math.block.latex in the TeX file,  and place  
it above the string.other.math.tex pattern, so that it matches first.
3) Even better, mix the two patterns into one.

> Brad
>

Haris

PS: Out of curiosity, what do you use instead of $$, and how did you  
historically come to do it that way? In the university of Chicago, I  
think we all do the displaymath mode that way. In fact, I haven't  
before met anyone not using it. Are there reasons against using it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20051106/d97446d5/attachment.html>


More information about the textmate mailing list