Fix conversion of n-th roots to mathematica and octave syntax.

* src/mathed/math_extern.C
	(pipeThroughOctave): take into account that the output from octave
	may contain ansi control sequences.

	* src/mathed/math_rootinset.[Ch]
	(MathRootInset::mathematica): new virtual method to output n-th
	roots in mathematica syntax.

	* src/mathed/math_rootinset.C
	(MathRootInset::octave): octave has not a root command.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@16612 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2007-01-08 19:00:24 +00:00
parent d2b8a31616
commit 7de882829b
4 changed files with 24 additions and 5 deletions

View File

@ -1,3 +1,13 @@
2007-01-08 Enrico Forestieri <forenr@tlc.unipr.it>
* src/mathed/math_extern.C (pipeThroughOctave): take into account
that the output from octave may contain ansi control sequences.
* src/mathed/math_rootinset.[Ch] (mathematica): new virtual method
to output n-th roots in mathematica syntax.
* src/mathed/math_rootinset.C (octave): octave has not a root command.
2006-12-29 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* math_nestinset.C (handleFont): avoid crash on undo when

View File

@ -1273,11 +1273,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 MathArrayInset("array", out));

View File

@ -97,9 +97,15 @@ void MathRootInset::maple(MapleStream & os) const
}
void MathRootInset::mathematica(MathematicaStream & os) const
{
os << '(' << cell(1) << ")^(1/(" << cell(0) <<"))";
}
void MathRootInset::octave(OctaveStream & os) const
{
os << "root(" << cell(1) << ',' << cell(0) << ')';
os << '(' << cell(1) << ")^(1/(" << cell(0) <<"))";
}

View File

@ -37,6 +37,8 @@ public:
///
void maple(MapleStream &) const;
///
void mathematica(MathematicaStream &) const;
///
void octave(OctaveStream &) const;
private:
virtual std::auto_ptr<InsetBase> doClone() const;