[TxMt] LaTeX diplaymath mode problems

Charilaos Skiadas cskiadas at uchicago.edu
Mon Nov 7 05:05:45 UTC 2005


On Nov 6, 2005, at 10:00 PM, Allan Odgaard wrote:

> On 07/11/2005, at 1.52, Charilaos Skiadas wrote:
>
>
>> [...] Then I would expect something like: \double{$x^2+1=0$} to  
>> recognize $x^2+1=0$ as math, which it does at the moment. The  
>> problem is that these commands are caught by the TeX syntax, so of  
>> course can only see stuff from the TeX syntax. Maybe an option  
>> would be to have them be caught by the LaTeX syntax also? It would  
>> be duplicating code, that's why I don't particularly like it as an  
>> approach
>>
>
> What can be done is to let the TeX syntax include "$base" for the  
> command argument, that will include the base syntax file, so that'd  
> be LaTeX when the document is marked up as LaTeX, and TeX when the  
> document is TeX.
>
Brilliant!!! That's exactly what I was hoping there would be.
> We use this e.g. in the C grammar, which has a few recursive rules,  
> and is (sometimes) included by the C++ or Objective-C grammar.
>
> Though not sure if there are other problems using the LaTeX grammar  
> recursively (as I got the impression of, from Brads comment).

Just tried it, and briefly looked at the test.tex file, and it looked  
ok to me. Maybe Brad can have a closer look at it?
I also looked at a bigger latex file I had, and that worked fine too.

I think maybe the problems that Brad was referring to might have had  
to do with fragile commands and stuff like that. In the sense that  
lots of LaTeX commands and environments alter things in a way that  
containing other commands inside the arguments could cause the  
processor to complain or produce unexpected results. But I don't  
think they are syntactically wrong, even if they don't compile properly.
Or maybe I'm waaay off and Brad's problems had to do with the code  
not being processed properly.

While we are at it looking at one of my tex-files I encountered  
another problem, with \citep. The following command:
\citep[see][Lemma~II.1.3]{Deligne:1970}
catches the 'see' and 'Lemma~II.1.3' together with the \citep.
The regexp reads:
             begin = '(\\cite(al)?[tp]?\*?(\[[^\]]*\]){,2}\{)';
             end = '(\})';
  I think I edited that command to catch the brackets, though not  
knowing how many square bracket arguments there would be (at most two  
are allowed in this case) I did know how to match them properly. Is  
there a nice way to do it? I am guessing it should be like the multi- 
argument function thingie. I am looking at it though, but I can't  
quite understand how it works. Can you explain a bit the logic for  
the end pattern? (  end = '(?=\s*[^\{\[\s])';   )

Haris


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


More information about the textmate mailing list