<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Haris,<DIV><BR class="khtml-block-placeholder"></DIV><DIV>Thanks for the file.  I'll take a look at it and see if I can see something.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>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 </DIV><DIV>help site:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Georgia" size="4"><SPAN class="Apple-style-span" style="font-size: 16px;">There are four environments that put LaTeX in math mode: </SPAN></FONT><A href="http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/teTeX/latex/latex2e-html/ltx-115.html#math"><FONT class="Apple-style-span" face="Georgia" size="4"><SPAN class="Apple-style-span" style="font-size: 16px;"><FONT class="Apple-style-span" color="#00009B">math</FONT></SPAN></FONT></A><FONT class="Apple-style-span" face="Georgia" size="4"><SPAN class="Apple-style-span" style="font-size: 16px;">, displaymath, </SPAN></FONT><A href="http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/teTeX/latex/latex2e-html/ltx-223.html"><FONT class="Apple-style-span" face="Georgia" size="4"><SPAN class="Apple-style-span" style="font-size: 16px;"><FONT class="Apple-style-span" color="#00009B">eqnarray</FONT></SPAN></FONT></A><FONT class="Apple-style-span" face="Georgia" size="4"><SPAN class="Apple-style-span" style="font-size: 16px;">, and </SPAN></FONT><A href="http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/teTeX/latex/latex2e-html/ltx-224.html"><FONT class="Apple-style-span" face="Georgia" size="4"><SPAN class="Apple-style-span" style="font-size: 16px;"><FONT class="Apple-style-span" color="#CF0000">equation</FONT></SPAN></FONT></A><FONT class="Apple-style-span" face="Georgia" size="4"><SPAN class="Apple-style-span" style="font-size: 16px;">. 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 </SPAN></FONT><FONT class="Apple-style-span" face="Georgia" size="4"><SPAN class="Apple-style-span" style="font-size: 16px;"><B>not</B></SPAN></FONT><FONT class="Apple-style-span" face="Georgia" size="4"><SPAN class="Apple-style-span" style="font-size: 16px;"> break lines in displaymath or equation environments unless told to do so with a </SPAN></FONT><A href="http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/teTeX/latex/latex2e-html/ltx-181.html"><FONT class="Apple-style-span" color="#00009B" face="Bitstream Vera Sans Mono">\\</FONT></A><FONT class="Apple-style-span" face="Georgia" size="4"><SPAN class="Apple-style-span" style="font-size: 16px;"> command.</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Georgia" size="4"><SPAN class="Apple-style-span" style="font-size: 16px;">The displaymath environment can be entered by</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Bitstream Vera Sans Mono">  </FONT><FONT class="Apple-style-span" face="Bitstream Vera Sans Mono">\begin{displaymath}</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Bitstream Vera Sans Mono">      </FONT><FONT class="Apple-style-span" face="Bitstream Vera Sans Mono">math equation \\</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Bitstream Vera Sans Mono">      </FONT><FONT class="Apple-style-span" face="Bitstream Vera Sans Mono">second line of math equation</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Bitstream Vera Sans Mono">  </FONT><FONT class="Apple-style-span" face="Bitstream Vera Sans Mono">\end{displaymath}</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Georgia" size="4"><SPAN class="Apple-style-span" style="font-size: 16px;">Because displaymath may be used frequently to display relatively short equations, there are convenient alternative forms:</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Bitstream Vera Sans Mono">  </FONT><FONT class="Apple-style-span" face="Bitstream Vera Sans Mono">\[ displayed math equation \]</FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Georgia" size="4"><SPAN class="Apple-style-span" style="font-size: 16px;">or (the following does not seem to be well documented, but appears to work)</SPAN></FONT></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><FONT class="Apple-style-span" face="Bitstream Vera Sans Mono">  </FONT><FONT class="Apple-style-span" face="Bitstream Vera Sans Mono">$$ dispalyed math equation $$</FONT></DIV><P style="margin: 0.0px 0.0px 8.0px 0.0px; font: 16.0px Georgia; min-height: 19.0px"><BR></P><DIV>I don't think there is any difference between equation* and displaymath but I could be wrong...</DIV><DIV><FONT class="Apple-style-span" face="Georgia" size="4"><SPAN class="Apple-style-span" style="font-size: 16px;"><BR class="khtml-block-placeholder"></SPAN></FONT></DIV><DIV>I think for purposes of scoping in TextMate we ought to treat them all the same.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Brad</DIV><DIV><BR><DIV><DIV>On Nov 6, 2005, at 5:09 PM, Charilaos Skiadas wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite">Hi Brad,<BR><DIV><DIV>On Nov 6, 2005, at 4:19 PM, Brad Miller wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">On Nov 6, 2005, at 3:54 PM, Charilaos Skiadas wrote:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">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:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">$$\int_{C_{t}}e^{g(z,t)}f(z,t)\d z$$ where $g,f$</DIV><BR></BLOCKQUOTE><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I pasted your example above into the test.tex document and the text between the $$ .. $$ is scoped as string.other.math.tex<SPAN class="Apple-converted-space">  </SPAN>The word 'where' is scoped as text.latex and the g,f is scoped as string.other.math.tex<SPAN class="Apple-converted-space">  </SPAN>I believe those are all correct yes?</DIV></BLOCKQUOTE></DIV><DIV><BR><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">So, now I'm curious as to whats different between your document and the test.tex document.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV></BLOCKQUOTE><DIV>So in my case, if I put the cursor between the double dollar signs at the beginning, the scope is string.other.math.tex. </DIV><DIV>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.</DIV><DIV>If I put it between the second set of double dollar signs, it is string.other.math.block.tex.</DIV><DIV><BR class="khtml-block-placeholder"></DIV>I'll send you separately my file, see if that helps, but there's not anything weird about it I think.<BR><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Is there a a reason to make the block math scope different than the regular math scope?<SPAN class="Apple-converted-space">  </SPAN>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?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV></BLOCKQUOTE>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.</DIV><DIV>What happens in this case is that the first double dollar signs are matched with the regex from the TeX bundle:</DIV><DIV>        {    name = 'string.other.math.tex';</DIV><DIV>            begin = '\$';</DIV><DIV>            end = '\$';</DIV><DIV>            swallow = '\\\$';</DIV><DIV>            ...</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>On the other hand, the second double dollar signs are matched as the begin regex from the LaTeX bundle:</DIV><DIV>        {    name = 'string.other.math.block.latex';</DIV><DIV>            begin = '\$\$';</DIV><DIV>            end = '\$\$';</DIV><DIV>        },</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>and the parser goes on to search the entire rest of the document for the closing $$</DIV><DIV>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:</DIV><DIV>1) Make it so that the string.other.math.tex regex needs to match something between the</DIV><DIV>            begin = '\$';</DIV><DIV>            end = '\$';</DIV><DIV>Not sure if this is possible.</DIV><DIV>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.</DIV><DIV>3) Even better, mix the two patterns into one.</DIV><DIV><BR><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Brad</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV></BLOCKQUOTE></DIV><FONT class="Apple-style-span" color="#0000DD"></FONT><BR><DIV>Haris</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>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?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">______________________________________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">For new threads USE THIS: <A href="mailto:textmate@lists.macromates.com">textmate@lists.macromates.com</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">(threading gets destroyed and the universe will collapse if you don't)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><A href="http://lists.macromates.com/mailman/listinfo/textmate">http://lists.macromates.com/mailman/listinfo/textmate</A></DIV> </BLOCKQUOTE></DIV><BR></DIV></BODY></HTML>