2 * \file InsetMathString.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 "InsetMathString.h"
14 #include "MathStream.h"
15 #include "MathStream.h"
16 #include "MathSupport.h"
25 InsetMathString::InsetMathString(docstring const & s)
30 auto_ptr<Inset> InsetMathString::doClone() const
32 return auto_ptr<Inset>(new InsetMathString(*this));
36 bool InsetMathString::metrics(MetricsInfo & mi, Dimension & dim) const
38 mathed_string_dim(mi.base.font, str_, dim);
46 void InsetMathString::draw(PainterInfo & pi, int x, int y) const
52 void InsetMathString::normalize(NormalStream & os) const
54 os << "[string " << str_ << ' ' << "mathalpha" << ']';
58 void InsetMathString::maple(MapleStream & os) const
60 if (/*code_ != LM_TC_VAR ||*/ str_.size() <= 1) {
61 os << ' ' << str_ << ' ';
65 // insert '*' between adjacent chars if type is LM_TC_VAR
67 for (size_t i = 1; i < str_.size(); ++i)
72 void InsetMathString::mathematica(MathematicaStream & os) const
74 os << ' ' << str_ << ' ';
78 void InsetMathString::octave(OctaveStream & os) const
80 if (/*code_ != LM_TC_VAR ||*/ str_.size() <= 1) {
81 os << ' ' << str_ << ' ';
85 // insert '*' between adjacent chars if type is LM_TC_VAR
87 for (size_t i = 1; i < str_.size(); ++i)
92 void InsetMathString::mathmlize(MathStream & os) const
95 if (code_ == LM_TC_VAR)
96 os << "<mi> " << str_ << " </mi>";
97 else if (code_ == LM_TC_CONST)
98 os << "<mn> " << str_ << " </mn>";
99 else if (code_ == LM_TC_RM || code_ == LM_TC_TEXTRM)
100 os << "<mtext> " << str_ << " </mtext>";
107 void InsetMathString::write(WriteStream & os) const