[TxMt] LaTeX diplaymath mode problems

Brad Miller bonelake at mac.com
Sun Nov 6 23:23:37 UTC 2005


Haris,

Thanks for the file.  I'll take a look at it and see if I can see  
something.

Rather than $$ I've always just used \begin{equation} or equation* if  
I didn't want equation numbers.  Thats just how I learned it a long  
time ago, and I've never had cause to do anything different.  From  
the LaTeX
help site:

There are four environments that put LaTeX in math mode: math,  
displaymath, eqnarray, and equation. The math environment is for  
formulas that appear right in the text. The displaymath and equation  
environments are for formulas that appear on their own line; they  
differ only insofar as the latter prints an equation number. LaTeX  
will not break lines in displaymath or equation environments unless  
told to do so with a \\ command.
The displaymath environment can be entered by
   \begin{displaymath}
       math equation \\
       second line of math equation
   \end{displaymath}
Because displaymath may be used frequently to display relatively  
short equations, there are convenient alternative forms:
   \[ displayed math equation \]
or (the following does not seem to be well documented, but appears to  
work)
   $$ dispalyed math equation $$


I don't think there is any difference between equation* and  
displaymath but I could be wrong...

I think for purposes of scoping in TextMate we ought to treat them  
all the same.

Brad

On Nov 6, 2005, at 5:09 PM, Charilaos Skiadas wrote:

> 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?
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20051106/47632585/attachment.html>


More information about the textmate mailing list