3 #include "math_exfuncinset.h"
4 #include "math_support.h"
5 #include "math_mathmlstream.h"
6 #include "math_streamstr.h"
9 MathExFuncInset::MathExFuncInset(string const & name)
10 : MathNestInset(1), name_(name)
14 MathExFuncInset::MathExFuncInset(string const & name, MathArray const & ar)
15 : MathNestInset(1), name_(name)
21 MathInset * MathExFuncInset::clone() const
23 return new MathExFuncInset(*this);
27 void MathExFuncInset::metrics(MathMetricsInfo & mi) const
29 mathed_string_dim(mi.base.font, name_, ascent_, descent_, width_);
33 void MathExFuncInset::draw(MathPainterInfo & pi, int x, int y) const
35 drawStrBlack(pi, x, y, name_);
39 void MathExFuncInset::normalize(NormalStream & os) const
41 os << '[' << name_ << ' ' << cell(0) << ']';
45 void MathExFuncInset::maplize(MapleStream & os) const
48 os << "linalg[det](" << cell(0) << ')';
50 os << name_ << '(' << cell(0) << ')';
54 string asMathematicaName(string const & name)
56 if (name == "sin") return "Sin";
57 if (name == "sinh") return "Sinh";
58 if (name == "arcsin") return "ArcSin";
59 if (name == "cos") return "Cos";
60 if (name == "cosh") return "Cosh";
61 if (name == "arcos") return "ArcCos";
62 if (name == "tan") return "Tan";
63 if (name == "tanh") return "Tanh";
64 if (name == "arctan") return "ArcTan";
65 if (name == "cot") return "Cot";
66 if (name == "coth") return "Coth";
67 if (name == "csc") return "Csc";
68 if (name == "sec") return "Sec";
69 if (name == "exp") return "Exp";
70 if (name == "log") return "Log";
71 if (name == "ln" ) return "Log";
76 void MathExFuncInset::mathematicize(MathematicaStream & os) const
78 os << asMathematicaName(name_) << '[' << cell(0) << ']';
82 void MathExFuncInset::mathmlize(MathMLStream & os) const
84 os << MTag(name_.c_str()) << cell(0) << ETag(name_.c_str());
88 void MathExFuncInset::octavize(OctaveStream & os) const
90 os << name_ << '(' << cell(0) << ')';
94 void MathExFuncInset::write(WriteStream & os) const
96 os << '\\' << name_ << '{' << cell(0) << '}';