2 * \file InsetMathExFunc.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 "InsetMathExFunc.h"
15 #include "MathMLStream.h"
16 #include "MathStream.h"
17 #include "MathSupport.h"
24 InsetMathExFunc::InsetMathExFunc(string const & name)
25 : InsetMathNest(1), name_(name)
29 InsetMathExFunc::InsetMathExFunc(string const & name, MathArray const & ar)
30 : InsetMathNest(1), name_(name)
36 auto_ptr<InsetBase> InsetMathExFunc::doClone() const
38 return auto_ptr<InsetBase>(new InsetMathExFunc(*this));
42 void InsetMathExFunc::metrics(MetricsInfo & mi, Dimension & /*dim*/) const
44 mathed_string_dim(mi.base.font, name_, dim_);
48 void InsetMathExFunc::draw(PainterInfo & pi, int x, int y) const
50 drawStrBlack(pi, x, y, name_);
54 string InsetMathExFunc::name() const
60 void InsetMathExFunc::maple(MapleStream & os) const
63 os << "linalg[det](" << cell(0) << ')';
65 os << name_ << '(' << cell(0) << ')';
69 void InsetMathExFunc::maxima(MaximaStream & os) const
72 os << "determinant(" << cell(0) << ')';
74 os << name_ << '(' << cell(0) << ')';
78 string asMathematicaName(string const & name)
80 if (name == "sin") return "Sin";
81 if (name == "sinh") return "Sinh";
82 if (name == "arcsin") return "ArcSin";
83 if (name == "asin") return "ArcSin";
84 if (name == "cos") return "Cos";
85 if (name == "cosh") return "Cosh";
86 if (name == "arccos") return "ArcCos";
87 if (name == "acos") return "ArcCos";
88 if (name == "tan") return "Tan";
89 if (name == "tanh") return "Tanh";
90 if (name == "arctan") return "ArcTan";
91 if (name == "atan") return "ArcTan";
92 if (name == "cot") return "Cot";
93 if (name == "coth") return "Coth";
94 if (name == "csc") return "Csc";
95 if (name == "sec") return "Sec";
96 if (name == "exp") return "Exp";
97 if (name == "log") return "Log";
98 if (name == "ln" ) return "Log";
99 if (name == "arg" ) return "Arg";
100 if (name == "det" ) return "Det";
101 if (name == "gcd" ) return "GCD";
102 if (name == "max" ) return "Max";
103 if (name == "min" ) return "Min";
104 if (name == "erf" ) return "Erf";
105 if (name == "erfc" ) return "Erfc";
110 void InsetMathExFunc::mathematica(MathematicaStream & os) const
112 os << asMathematicaName(name_) << '[' << cell(0) << ']';
116 void InsetMathExFunc::mathmlize(MathMLStream & os) const
118 os << MTag(name_.c_str()) << cell(0) << ETag(name_.c_str());
122 void InsetMathExFunc::octave(OctaveStream & os) const
124 os << name_ << '(' << cell(0) << ')';