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"
27 InsetMathExFunc::InsetMathExFunc(string const & name)
28 : InsetMathNest(1), name_(name)
32 InsetMathExFunc::InsetMathExFunc(string const & name, MathArray const & ar)
33 : InsetMathNest(1), name_(name)
39 auto_ptr<InsetBase> InsetMathExFunc::doClone() const
41 return auto_ptr<InsetBase>(new InsetMathExFunc(*this));
45 void InsetMathExFunc::metrics(MetricsInfo & mi, Dimension & /*dim*/) const
48 mathed_string_dim(mi.base.font, from_utf8(name_), dim_);
52 void InsetMathExFunc::draw(PainterInfo & pi, int x, int y) const
55 drawStrBlack(pi, x, y, from_utf8(name_));
59 string InsetMathExFunc::name() const
65 void InsetMathExFunc::maple(MapleStream & os) const
68 os << "linalg[det](" << cell(0) << ')';
70 os << name_ << '(' << cell(0) << ')';
74 void InsetMathExFunc::maxima(MaximaStream & os) const
77 os << "determinant(" << cell(0) << ')';
79 os << name_ << '(' << cell(0) << ')';
83 string asMathematicaName(string const & name)
85 if (name == "sin") return "Sin";
86 if (name == "sinh") return "Sinh";
87 if (name == "arcsin") return "ArcSin";
88 if (name == "asin") return "ArcSin";
89 if (name == "cos") return "Cos";
90 if (name == "cosh") return "Cosh";
91 if (name == "arccos") return "ArcCos";
92 if (name == "acos") return "ArcCos";
93 if (name == "tan") return "Tan";
94 if (name == "tanh") return "Tanh";
95 if (name == "arctan") return "ArcTan";
96 if (name == "atan") return "ArcTan";
97 if (name == "cot") return "Cot";
98 if (name == "coth") return "Coth";
99 if (name == "csc") return "Csc";
100 if (name == "sec") return "Sec";
101 if (name == "exp") return "Exp";
102 if (name == "log") return "Log";
103 if (name == "ln" ) return "Log";
104 if (name == "arg" ) return "Arg";
105 if (name == "det" ) return "Det";
106 if (name == "gcd" ) return "GCD";
107 if (name == "max" ) return "Max";
108 if (name == "min" ) return "Min";
109 if (name == "erf" ) return "Erf";
110 if (name == "erfc" ) return "Erfc";
115 void InsetMathExFunc::mathematica(MathematicaStream & os) const
117 os << asMathematicaName(name_) << '[' << cell(0) << ']';
121 void InsetMathExFunc::mathmlize(MathMLStream & os) const
123 os << MTag(name_.c_str()) << cell(0) << ETag(name_.c_str());
127 void InsetMathExFunc::octave(OctaveStream & os) const
129 os << name_ << '(' << cell(0) << ')';