diff --git a/src/mathed/InsetMathRoot.C b/src/mathed/InsetMathRoot.C index bf0112a2da..c6b60b69da 100644 --- a/src/mathed/InsetMathRoot.C +++ b/src/mathed/InsetMathRoot.C @@ -103,9 +103,15 @@ void InsetMathRoot::maple(MapleStream & os) const } +void InsetMathRoot::mathematica(MathematicaStream & os) const +{ + os << '(' << cell(1) << ")^(1/(" << cell(0) <<"))"; +} + + void InsetMathRoot::octave(OctaveStream & os) const { - os << "root(" << cell(1) << ',' << cell(0) << ')'; + os << '(' << cell(1) << ")^(1/(" << cell(0) <<"))"; } diff --git a/src/mathed/InsetMathRoot.h b/src/mathed/InsetMathRoot.h index 57af6ae83a..0ba0653261 100644 --- a/src/mathed/InsetMathRoot.h +++ b/src/mathed/InsetMathRoot.h @@ -40,6 +40,8 @@ public: /// void maple(MapleStream &) const; /// + void mathematica(MathematicaStream &) const; + /// void octave(OctaveStream &) const; private: virtual std::auto_ptr doClone() const; diff --git a/src/mathed/MathExtern.C b/src/mathed/MathExtern.C index a70106d9ea..30dfaa346e 100644 --- a/src/mathed/MathExtern.C +++ b/src/mathed/MathExtern.C @@ -1283,11 +1283,12 @@ namespace { expr.insert(pos, 1, '*'); } - if (out.size() < 6) + // remove 'ans = ' taking into account that there may be an + // ansi control sequence before, such as '\033[?1034hans = ' + size_t i = out.find("ans = "); + if (i == string::npos) return MathArray(); - - // remove 'ans = ' - out = out.substr(6); + out = out.substr(i + 6); // parse output as matrix or single number MathAtom at(new InsetMathArray(from_ascii("array"), from_utf8(out)));