X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2Fmath_extern.C;h=f595b1b1686d040165163cac6a3640b5f3fa61db;hb=254272868f1d891b9d0a778f871afb23cce84081;hp=be0a463790c852b2a2e601982e5f13fb0a090134;hpb=f1c24d100985c6df2eb5ec390017b69c78fe49c7;p=lyx.git diff --git a/src/mathed/math_extern.C b/src/mathed/math_extern.C index be0a463790..f595b1b168 100644 --- a/src/mathed/math_extern.C +++ b/src/mathed/math_extern.C @@ -331,18 +331,32 @@ void extractExps(MathArray & ar) if (!sup || sup->hasDown()) continue; - // create a proper exp-inset as replacement - MathExFuncInset * func = new MathExFuncInset("exp"); - func->cell(0) = sup->cell(1); - - // clean up - (*it).reset(func); + // create a proper exp-inset as replacement + *it = new MathExFuncInset("exp", sup->cell(1)); ar.erase(it + 1); } //lyxerr << "\nExps to: " << ar << "\n"; } +// +// extract det(...) from |matrix| +// +void extractDets(MathArray & ar) +{ + //lyxerr << "\ndet from: " << ar << "\n"; + for (MathArray::iterator it = ar.begin(); it != ar.end(); ++it) { + MathDelimInset * del = (*it)->asDelimInset(); + if (!del) + continue; + if (!del->isAbs()) + continue; + *it = new MathExFuncInset("det", del->cell(0)); + } + //lyxerr << "\ndet to: " << ar << "\n"; +} + + // // search numbers // @@ -404,9 +418,7 @@ bool testCloseParan(MathInset * p) MathInset * replaceDelims(const MathArray & ar) { - MathDelimInset * del = new MathDelimInset("(", ")"); - del->cell(0) = ar; - return del; + return new MathDelimInset("(", ")", ar); } @@ -761,6 +773,7 @@ void extractStructure(MathArray & ar) extractMatrices(ar); extractDelims(ar); extractFunctions(ar); + extractDets(ar); extractIntegrals(ar); extractSums(ar); extractDiff(ar); @@ -911,6 +924,7 @@ namespace { ms << ar; string expr = os.str().c_str(); lyxerr << "ar: '" << ar << "'\n"; + lyxerr << "ms: '" << os.str() << "'\n"; for (int i = 0; i < 100; ++i) { // at most 100 attempts // try to fix missing '*' the hard way by using mint