#include <config.h>
#include "InsetMathExInt.h"
+
+#include "LaTeXFeatures.h"
#include "MathData.h"
#include "MathStream.h"
-#include "MathStream.h"
#include "InsetMathSymbol.h"
#include "support/debug.h"
}
-bool InsetMathExInt::isExIntOperator(docstring const & name)
-{
- std::string const & sname = to_utf8(name);
- return sname == "sum" || sname == "prod";
-}
-
-
void InsetMathExInt::maple(MapleStream & os) const
{
- // FIXME Products and the like may need special treatment.
os << symbol_ << '(';
- if (cell(0).size())
+ if (!cell(0).empty())
os << cell(0);
else
os << '1';
void InsetMathExInt::maxima(MaximaStream & os) const
{
- // FIXME Products and the like may need special treatment.
if (symbol_ == "int")
os << "integrate(";
else
os << symbol_ << '(';
- if (cell(0).size())
+ if (!cell(0).empty())
os << cell(0) << ',';
else
os << '1' << ',';
os << cell(1) << ')';
}
-
void InsetMathExInt::mathematica(MathematicaStream & os) const
{
- // FIXME Products and the like may need special treatment.
if (symbol_ == "int")
os << "Integrate[";
else if (symbol_ == "sum")
else
os << symbol_ << '[';
- if (cell(0).size())
+ if (!cell(0).empty())
os << cell(0) << ',';
else
os << '1' << ',';
}
-void InsetMathExInt::mathmlize(MathStream & os) const
+void InsetMathExInt::mathmlize(MathMLStream & ms) const
{
+ // At the moment, we are not extracting sums and the like for MathML.
+ // If we should decide to do so later, then we'll need to re-merge
+ // r32566 and r32568.
+ // So right now this only handles integrals.
InsetMathSymbol sym(symbol_);
- if (isExIntOperator(symbol_)) {
- bool const lower = !cell(1).empty();
- bool const upper = !cell(3).empty();
- if (lower && upper)
- os << MTag("msubsup");
- else if (lower)
- os << MTag("msub");
- else if (upper)
- os << MTag("msup");
- os << MTag("mrow");
- sym.mathmlize(os);
- os << ETag("mrow");
- if (lower) {
- os << MTag("mrow");
- os << cell(1);
- if (!cell(2).empty())
- os << MTag("mo") << "=" << ETag("mo")
- << cell(2);
- os << ETag("mrow");
- }
- if (upper)
- os << MTag("mrow") << cell(3) << ETag("mrow");
- if (lower && upper)
- os << ETag("msubsup");
- else if (lower)
- os << ETag("msub");
- else if (upper)
- os << ETag("msup");
- os << cell(0);
- return;
- }
- // some kind of integral
bool const lower = !cell(2).empty();
bool const upper = !cell(3).empty();
if (lower && upper)
- os << MTag("msubsup");
+ ms << MTag("msubsup");
else if (lower)
- os << MTag("msub");
+ ms << MTag("msub");
else if (upper)
- os << MTag("msup");
- os << MTag("mrow");
- sym.mathmlize(os);
- os << ETag("mrow");
+ ms << MTag("msup");
+ ms << MTag("mrow");
+ sym.mathmlize(ms);
+ ms << ETag("mrow");
if (lower)
- os << MTag("mrow") << cell(2) << ETag("mrow");
+ ms << cell(2);
if (upper)
- os << MTag("mrow") << cell(3) << ETag("mrow");
+ ms << cell(3);
if (lower && upper)
- os << ETag("msubsup");
+ ms << ETag("msubsup");
else if (lower)
- os << ETag("msub");
+ ms << ETag("msub");
+ else if (upper)
+ ms << ETag("msup");
+ ms << cell(0)
+ << "<" << from_ascii(ms.namespacedTag("mo")) << "> "
+ << " ⁢ "
+ << "</" << from_ascii(ms.namespacedTag("mo")) << ">"
+ << MTag("mrow")
+ << "<" << from_ascii(ms.namespacedTag("mo")) << "> "
+ << " ⅆ "
+ << "</" << from_ascii(ms.namespacedTag("mo")) << ">"
+ << cell(1)
+ << ETag("mrow");
+}
+
+
+void InsetMathExInt::htmlize(HtmlStream & os) const
+{
+ // At the moment, we are not extracting sums and the like for HTML.
+ // So right now this only handles integrals.
+ InsetMathSymbol sym(symbol_);
+ bool const lower = !cell(2).empty();
+ bool const upper = !cell(3).empty();
+
+ os << MTag("span", "class='integral'")
+ << MTag("span", "class='intsym'");
+ sym.htmlize(os, false);
+ os << ETag("span");
+
+ if (lower && upper) {
+ os << MTag("span", "class='limits'")
+ << MTag("span") << cell(2) << ETag("span")
+ << MTag("span") << cell(3) << ETag("span")
+ << ETag("span");
+ } else if (lower)
+ os << MTag("sub", "class='limit'") << cell(2) << ETag("sub");
else if (upper)
- os << ETag("msup");
- os << cell(0) << "<mo> ⁢ </mo>"
- << MTag("mrow") << "<mo> ⅆ </mo>"
- << cell(1) << ETag("mrow");
+ os << MTag("sup", "class='limit'") << cell(3) << ETag("sup");
+ os << cell(0) << "<b>d</b>" << cell(1) << ETag("span");
}
-void InsetMathExInt::write(WriteStream &) const
+void InsetMathExInt::write(TeXMathStream &) const
{
LYXERR0("should not happen");
}