mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-15 07:16:48 +00:00
Fix conversion of n-th roots to mathematica and octave syntax.
* src/mathed/MathExtern.C (pipeThroughOctave): take into account that the output from octave may contain ansi control sequences. * src/mathed/InsetMathRoot.[Ch] (InsetMathRoot::mathematica): new virtual method to output n-th roots in mathematica syntax. * src/mathed/InsetMathRoot.C (InsetMathRoot::octave): octave has not a root() command. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16559 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fc86d802ee
commit
4709a0c535
@ -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) <<"))";
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,6 +40,8 @@ public:
|
||||
///
|
||||
void maple(MapleStream &) const;
|
||||
///
|
||||
void mathematica(MathematicaStream &) const;
|
||||
///
|
||||
void octave(OctaveStream &) const;
|
||||
private:
|
||||
virtual std::auto_ptr<InsetBase> doClone() const;
|
||||
|
@ -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)));
|
||||
|
Loading…
Reference in New Issue
Block a user