2 * \file InsetMathExFunc.cpp
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 "MathStream.h"
16 #include "MathStream.h"
17 #include "MathSupport.h"
25 InsetMathExFunc::InsetMathExFunc(docstring const & name)
26 : InsetMathNest(1), name_(name)
30 InsetMathExFunc::InsetMathExFunc(docstring const & name, MathData const & ar)
31 : InsetMathNest(1), name_(name)
37 Inset * InsetMathExFunc::clone() const
39 return new InsetMathExFunc(*this);
43 void InsetMathExFunc::metrics(MetricsInfo & mi, Dimension & dim) const
45 mathed_string_dim(mi.base.font, name_, dim);
50 void InsetMathExFunc::draw(PainterInfo & pi, int x, int y) const
52 drawStrBlack(pi, x, y, name_);
56 docstring InsetMathExFunc::name() const
62 void InsetMathExFunc::maple(MapleStream & os) const
65 os << "linalg[det](" << cell(0) << ')';
67 os << name_ << '(' << cell(0) << ')';
71 void InsetMathExFunc::maxima(MaximaStream & os) const
74 os << "determinant(" << cell(0) << ')';
76 os << name_ << '(' << cell(0) << ')';
80 static string asMathematicaName(string const & name)
82 if (name == "sin") return "Sin";
83 if (name == "sinh") return "Sinh";
84 if (name == "arcsin") return "ArcSin";
85 if (name == "asin") return "ArcSin";
86 if (name == "cos") return "Cos";
87 if (name == "cosh") return "Cosh";
88 if (name == "arccos") return "ArcCos";
89 if (name == "acos") return "ArcCos";
90 if (name == "tan") return "Tan";
91 if (name == "tanh") return "Tanh";
92 if (name == "arctan") return "ArcTan";
93 if (name == "atan") return "ArcTan";
94 if (name == "cot") return "Cot";
95 if (name == "coth") return "Coth";
96 if (name == "csc") return "Csc";
97 if (name == "sec") return "Sec";
98 if (name == "exp") return "Exp";
99 if (name == "log") return "Log";
100 if (name == "ln" ) return "Log";
101 if (name == "arg" ) return "Arg";
102 if (name == "det" ) return "Det";
103 if (name == "gcd" ) return "GCD";
104 if (name == "max" ) return "Max";
105 if (name == "min" ) return "Min";
106 if (name == "erf" ) return "Erf";
107 if (name == "erfc" ) return "Erfc";
112 static docstring asMathematicaName(docstring const & name)
114 return from_utf8(asMathematicaName(to_utf8(name)));
118 void InsetMathExFunc::mathematica(MathematicaStream & os) const
120 os << asMathematicaName(name_) << '[' << cell(0) << ']';
124 void InsetMathExFunc::mathmlize(MathStream & os) const
126 os << MTag(name_.c_str()) << cell(0) << ETag(name_.c_str());
130 void InsetMathExFunc::octave(OctaveStream & os) const
132 os << name_ << '(' << cell(0) << ')';