2 * \file math_exfuncinset.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "math_exfuncinset.h"
14 #include "math_support.h"
15 #include "math_mathmlstream.h"
16 #include "math_streamstr.h"
21 MathExFuncInset::MathExFuncInset(string const & name)
22 : MathNestInset(1), name_(name)
26 MathExFuncInset::MathExFuncInset(string const & name, MathArray const & ar)
27 : MathNestInset(1), name_(name)
33 auto_ptr<InsetBase> MathExFuncInset::clone() const
35 return auto_ptr<InsetBase>(new MathExFuncInset(*this));
39 void MathExFuncInset::metrics(MetricsInfo & mi, Dimension & /*dim*/) const
41 mathed_string_dim(mi.base.font, name_, dim_);
45 void MathExFuncInset::draw(PainterInfo & pi, int x, int y) const
47 drawStrBlack(pi, x, y, name_);
51 string MathExFuncInset::name() const
57 void MathExFuncInset::maple(MapleStream & os) const
60 os << "linalg[det](" << cell(0) << ')';
62 os << name_ << '(' << cell(0) << ')';
66 void MathExFuncInset::maxima(MaximaStream & os) const
69 os << "determinant(" << cell(0) << ')';
71 os << name_ << '(' << cell(0) << ')';
75 string asMathematicaName(string const & name)
77 if (name == "sin") return "Sin";
78 if (name == "sinh") return "Sinh";
79 if (name == "arcsin") return "ArcSin";
80 if (name == "cos") return "Cos";
81 if (name == "cosh") return "Cosh";
82 if (name == "arcos") return "ArcCos";
83 if (name == "tan") return "Tan";
84 if (name == "tanh") return "Tanh";
85 if (name == "arctan") return "ArcTan";
86 if (name == "cot") return "Cot";
87 if (name == "coth") return "Coth";
88 if (name == "csc") return "Csc";
89 if (name == "sec") return "Sec";
90 if (name == "exp") return "Exp";
91 if (name == "log") return "Log";
92 if (name == "ln" ) return "Log";
97 void MathExFuncInset::mathematica(MathematicaStream & os) const
99 os << asMathematicaName(name_) << '[' << cell(0) << ']';
103 void MathExFuncInset::mathmlize(MathMLStream & os) const
105 os << MTag(name_.c_str()) << cell(0) << ETag(name_.c_str());
109 void MathExFuncInset::octave(OctaveStream & os) const
111 os << name_ << '(' << cell(0) << ')';