7 #include "math_stringinset.h"
8 #include "math_mathmlstream.h"
9 #include "math_streamstr.h"
11 #include "math_support.h"
12 #include "math_parser.h"
13 #include "LaTeXFeatures.h"
17 MathStringInset::MathStringInset(string const & s)
22 MathInset * MathStringInset::clone() const
24 return new MathStringInset(*this);
28 void MathStringInset::metrics(MathMetricsInfo & mi) const
30 mathed_string_dim(mi.base.font, str_, ascent_, descent_, width_);
34 void MathStringInset::draw(MathPainterInfo & pi, int x, int y) const
36 //lyxerr << "drawing '" << str_ << "' code: " << code_ << endl;
37 drawStr(pi, pi.base.font, x, y, str_);
41 void MathStringInset::normalize(NormalStream & os) const
43 os << "[string " << str_ << ' ' << "mathalpha" << "]";
47 void MathStringInset::maplize(MapleStream & os) const
49 if (/*code_ != LM_TC_VAR || */ str_.size() <= 1) {
50 os << ' ' << str_ << ' ';
54 // insert '*' between adjacent chars if type is LM_TC_VAR
56 for (string::size_type i = 1; i < str_.size(); ++i)
61 void MathStringInset::octavize(OctaveStream & os) const
63 if (/*code_ != LM_TC_VAR ||*/ str_.size() <= 1) {
64 os << ' ' << str_ << ' ';
68 // insert '*' between adjacent chars if type is LM_TC_VAR
70 for (string::size_type i = 1; i < str_.size(); ++i)
75 void MathStringInset::mathmlize(MathMLStream & os) const
78 if (code_ == LM_TC_VAR)
79 os << "<mi> " << str_ << " </mi>";
80 else if (code_ == LM_TC_CONST)
81 os << "<mn> " << str_ << " </mn>";
82 else if (code_ == LM_TC_RM || code_ == LM_TC_TEXTRM)
83 os << "<mtext> " << str_ << " </mtext>";
90 void MathStringInset::write(WriteStream & os) const