3 #include "math_exfuncinset.h"
4 #include "math_support.h"
5 #include "math_mathmlstream.h"
6 #include "math_streamstr.h"
11 MathExFuncInset::MathExFuncInset(string const & name)
12 : MathNestInset(1), name_(name)
16 MathExFuncInset::MathExFuncInset(string const & name, MathArray const & ar)
17 : MathNestInset(1), name_(name)
23 auto_ptr<InsetBase> MathExFuncInset::clone() const
25 return auto_ptr<InsetBase>(new MathExFuncInset(*this));
29 void MathExFuncInset::metrics(MetricsInfo & mi, Dimension & /*dim*/) const
31 mathed_string_dim(mi.base.font, name_, dim_);
35 void MathExFuncInset::draw(PainterInfo & pi, int x, int y) const
37 drawStrBlack(pi, x, y, name_);
41 string MathExFuncInset::name() const
47 void MathExFuncInset::maple(MapleStream & os) const
50 os << "linalg[det](" << cell(0) << ')';
52 os << name_ << '(' << cell(0) << ')';
56 void MathExFuncInset::maxima(MaximaStream & os) const
59 os << "determinant(" << cell(0) << ')';
61 os << name_ << '(' << cell(0) << ')';
65 string asMathematicaName(string const & name)
67 if (name == "sin") return "Sin";
68 if (name == "sinh") return "Sinh";
69 if (name == "arcsin") return "ArcSin";
70 if (name == "cos") return "Cos";
71 if (name == "cosh") return "Cosh";
72 if (name == "arcos") return "ArcCos";
73 if (name == "tan") return "Tan";
74 if (name == "tanh") return "Tanh";
75 if (name == "arctan") return "ArcTan";
76 if (name == "cot") return "Cot";
77 if (name == "coth") return "Coth";
78 if (name == "csc") return "Csc";
79 if (name == "sec") return "Sec";
80 if (name == "exp") return "Exp";
81 if (name == "log") return "Log";
82 if (name == "ln" ) return "Log";
87 void MathExFuncInset::mathematica(MathematicaStream & os) const
89 os << asMathematicaName(name_) << '[' << cell(0) << ']';
93 void MathExFuncInset::mathmlize(MathMLStream & os) const
95 os << MTag(name_.c_str()) << cell(0) << ETag(name_.c_str());
99 void MathExFuncInset::octave(OctaveStream & os) const
101 os << name_ << '(' << cell(0) << ')';