2 * \file InsetMathExInt.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 "InsetMathExInt.h"
15 #include "LaTeXFeatures.h"
17 #include "MathStream.h"
18 #include "InsetMathSymbol.h"
20 #include "support/debug.h"
21 #include "support/docstring.h"
26 InsetMathExInt::InsetMathExInt(Buffer * buf, docstring const & name)
27 : InsetMathNest(buf, 4), symbol_(name)
36 Inset * InsetMathExInt::clone() const
38 return new InsetMathExInt(*this);
42 void InsetMathExInt::symbol(docstring const & symbol)
48 bool InsetMathExInt::hasScripts() const
50 // take empty upper bound as "no scripts"
51 return !cell(3).empty();
56 void InsetMathExInt::normalize(NormalStream & os) const
58 os << '[' << symbol_ << ' ' << cell(0) << ' ' << cell(1) << ' '
59 << cell(2) << ' ' << cell(3) << ']';
63 void InsetMathExInt::metrics(MetricsInfo &, Dimension &) const
65 LYXERR0("should not happen");
69 void InsetMathExInt::draw(PainterInfo &, int, int) const
71 LYXERR0("should not happen");
75 void InsetMathExInt::maple(MapleStream & os) const
84 os << '=' << cell(2) << ".." << cell(3);
89 void InsetMathExInt::maxima(MaximaStream & os) const
101 os << cell(1) << ',' << cell(2) << ',' << cell(3) << ')';
103 os << cell(1) << ')';
106 void InsetMathExInt::mathematica(MathematicaStream & os) const
108 if (symbol_ == "int")
110 else if (symbol_ == "sum")
113 os << symbol_ << '[';
115 if (!cell(0).empty())
116 os << cell(0) << ',';
120 os << '{' << cell(1) << ',' << cell(2) << ',' << cell(3) << "}]";
122 os << cell(1) << ']';
126 void InsetMathExInt::mathmlize(MathMLStream & ms) const
128 // At the moment, we are not extracting sums and the like for MathML.
129 // If we should decide to do so later, then we'll need to re-merge
130 // r32566 and r32568.
131 // So right now this only handles integrals.
132 InsetMathSymbol sym(symbol_);
133 bool const lower = !cell(2).empty();
134 bool const upper = !cell(3).empty();
136 ms << MTag("msubsup");
145 ms << MTag("mrow") << cell(2) << ETag("mrow");
147 ms << MTag("mrow") << cell(3) << ETag("mrow");
149 ms << ETag("msubsup");
155 << "<" << from_ascii(ms.namespacedTag("mo")) << "> "
156 << " ⁢ "
157 << "</" << from_ascii(ms.namespacedTag("mo")) << ">"
159 << "<" << from_ascii(ms.namespacedTag("mo")) << "> "
160 << " ⅆ "
161 << "</" << from_ascii(ms.namespacedTag("mo")) << ">"
167 void InsetMathExInt::htmlize(HtmlStream & os) const
169 // At the moment, we are not extracting sums and the like for HTML.
170 // So right now this only handles integrals.
171 InsetMathSymbol sym(symbol_);
172 bool const lower = !cell(2).empty();
173 bool const upper = !cell(3).empty();
175 os << MTag("span", "class='integral'")
176 << MTag("span", "class='intsym'");
177 sym.htmlize(os, false);
180 if (lower && upper) {
181 os << MTag("span", "class='limits'")
182 << MTag("span") << cell(2) << ETag("span")
183 << MTag("span") << cell(3) << ETag("span")
186 os << MTag("sub", "class='limit'") << cell(2) << ETag("sub");
188 os << MTag("sup", "class='limit'") << cell(3) << ETag("sup");
189 os << cell(0) << "<b>d</b>" << cell(1) << ETag("span");
193 void InsetMathExInt::write(TeXMathStream &) const
195 LYXERR0("should not happen");