<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">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></BODY></HTML>