On Fri, Nov 09, 2007 at 01:58:01PM +0100, Helge Hafting wrote: > Martin Vermeer wrote: > > On Thu, 08 Nov 2007 10:38:44 +0100 > > Helge Hafting <[EMAIL PROTECTED]> wrote: > > > >> As for branches in math - the wishlist item would be > >> proper support (i.e. insert->branch working inside math too.) > >> > >> Helge Hafting > >> > > > > That would require a complete rewrite of text-in-math. It would be > > great if someone did this. > > > That'd be nice - sure. > Seems there is a simpler solution though. > Do "insert->branch" have to insert a "text thing" that > would need this improved text-in-math? > > How about having a "math-branch" inset too? This would only > go inside math, and not change between math and text modes. > So it'd still be math inside this kind of branch. > > Insert->Branch > would then insert either a text branch or a math branch depending > on cursor location. If the cursor is in math - insert the math branch kind. > > For users, it'd simply look like branches works everywhere. I assume > this is less work than the text-in-math rewrite, but could be wrong of > course. > > Helge Hafting
I suppose this is more or less what Jean-Marc has in mind. It _appears_ doable, even in the PC way where LyX, not LaTeX, handles the conditional outputting: one can, in math, have a LaTeX output differing from the LyX serialization ("write") routine -- e.g., have an arg enclosed in [] instead of the standard {} --, but then, as Georg pointed out, you also have to add special code in the math parser to translate the LaTeX in the LyX math insets back to this standard form. I actually did this when implementing the nicefrac extensions, so it can be done. HOWEVER... how are you going to parse back a LaTeX math expression which has been suppressed? It's no longer there... so this mechanism won't work, at least in "politically correct mode". We would have to sacrifice the equality between the LaTeX inside the LyX math inset, and the LaTeX that gets output. Do we want to go there? - Martin