[EMAIL PROTECTED] wrote: > Modified: lyx-devel/trunk/src/mathed/MathFactory.cpp > URL: > http://www.lyx.org/trac/file/lyx-devel/trunk/src/mathed/MathFactory.cpp?rev=20290 > ============================================================================== > --- lyx-devel/trunk/src/mathed/MathFactory.cpp (original) +++ > lyx-devel/trunk/src/mathed/MathFactory.cpp Sat Sep 15 18:39:51 2007 @@ > -260,7 +260,7 @@ > > MathAtom createInsetMath(docstring const & s) > { > - //lyxerr << "creating inset with name: '" << s << '\'' << endl; > + //lyxerr << "creating inset with name: '" << to_utf8(s) << '\'' << endl; > latexkeys const * l = in_word_set(s); > if (l) { > docstring const & inset = l->inset; > @@ -372,6 +372,10 @@ > return MathAtom(new InsetMathFrac(InsetMathFrac::NICEFRAC)); > if (s == "unitfrac") > return MathAtom(new InsetMathFrac(InsetMathFrac::UNITFRAC)); > + if (s == "unitfracthree") > + return MathAtom(new InsetMathFrac(InsetMathFrac::UNITFRAC3, 3)); > + if (s == "unit") > + return MathAtom(new InsetMathFrac(InsetMathFrac::UNIT));
Mathed does not work like this, you cannot use \unitfracthree here. What you did created a new command \unitfracthree that can be read from .lyx files, but that is never written. And I would be surprised if \unit[a]{b}{c} is read correctly from LyX files. To fix this, you need to remove _all_ occurences of \unitfracthree from the code and create a special case for \unit in MathParser.cpp (see \sqrt for an example, although a separate inset is probably not needed). In general, if you implement a new math command you have no choice but to handle all possible arguments. Otherwise you get a nasty situation that certain things are impossible to enter, see the xymatrix bugs in bugzilla. Georg