Am 23.05.2007 um 01:52 schrieb Uwe Stöhr:

First, I like your patch and give an OK.

> FYI, I tried with these examples:

> 5 \newcommand{\foo}[2][\frac{1}{2}]{(#1|#2)} $\foo 1{23}345$
> 6 \newcommand{\foo}[2][\frac{1}{2}]{(#1|#2)} $\foo 1{23}345$
What is the difference?

Nothing :)

Only for information: Why can't this and 5 and 6 not be imported into a MathMacro?:

Optional parameters are not supported.

> 11 \def\foo A#1B{(#1)} $\foo 1{23}345$
> 12 \def\foo#1..#2{(#1|#2)} $\foo 1{23}345$

11 will transform only "\foo A1B into (1), i.e. with pattern matching. That's not supported by the MathParser (maybe it could be done, but it's just not implemented). 12 is similar.

> 13 \def\foo#1#3{(#1|#2)} $\foo 1{23}345$
> 14 \def\foo#1#1{(#1|#2)} $\foo 1{23}345$

These two are not valid. The parameter numbers must increase exactly by one, without duplication, starting from 1.

> A recursive macro like \def\foo#1{\def\baa{#1}} is parsed, creating first the \baa MathMacro, then > the \foo MathMacro with a \baa MathMacro inside. I think we have to exclude this case, i.e. a
> recursive macro should go into an ERT as well.

Why do you think it should be excluded? Currently I can create recursive MathMacros I only have to assure the correct definition order.

It should be included because it is not properly evaluated. LyX only has a global macro table at the moment. So "calling" a recursive macro twice will result in strange results.

Btw. while you are working on this stuff: I pointed out in bug 1394
http://bugzilla.lyx.org/show_bug.cgi?id=1394
that it is annoying that the definitions aren't placed to the document preamble. There should at least be an option to put the definitions t the preamble, there is no reason why this is not allowed.

Well, we could put macro into the preamble which are defined at the very beginning of the document. In all other cases there is a semantical difference if the macro's name already appears before.

Don't know how to do it properly. Maybe one could mark macros as preamble-macros? Any suggestion?

Stefan


Attachment: PGP.sig
Description: Signierter Teil der Nachricht

Reply via email to