<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On Nov 6, 2005, at 10:00 PM, Allan Odgaard wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">On 07/11/2005, at 1.52, Charilaos Skiadas wrote:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV> <BR><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">[...] 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</DIV> <BR></BLOCKQUOTE><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; ">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.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV></BLOCKQUOTE>Brilliant!!! That's exactly what I was hoping there would be.<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; ">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.</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; ">Though not sure if there are other problems using the LaTeX grammar recursively (as I got the impression of, from Brads comment).</DIV></BLOCKQUOTE></DIV><FONT class="Apple-style-span" color="#000000"><BR></FONT><DIV><FONT class="Apple-style-span" color="#0D0D0D"><FONT class="Apple-style-span" color="#0C0C0C"><FONT class="Apple-style-span" color="#080808"><FONT class="Apple-style-span" color="#000000"><FONT class="Apple-style-span" color="#000000">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? </FONT></FONT></FONT></FONT></FONT></DIV><DIV>I also looked at a bigger latex file I had, and that worked fine too.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>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.</DIV><DIV>Or maybe I'm waaay off and Brad's problems had to do with the code not being processed properly.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>While we are at it looking at one of my tex-files I encountered another problem, with \citep. The following command:</DIV><DIV>\citep[see][Lemma~II.1.3]{Deligne:1970}</DIV><DIV>catches the 'see' and 'Lemma~II.1.3' together with the \citep.</DIV><DIV>The regexp reads:</DIV><DIV> begin = '(\\cite(al)?[tp]?\*?(\[[^\]]*\]){,2}\{)';</DIV><DIV> end = '(\})';</DIV><DIV> 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])'; ) </DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><DIV>Haris</DIV><DIV><BR class="khtml-block-placeholder"></DIV> </DIV><BR></BODY></HTML>