+void InsetMathStackrel::mathmlize(MathStream & ms) const
+{
+ if (nargs() > 2)
+ ms << "<munderover>" << cell(1) << cell(2) << cell(0) << "</munderover>";
+ else
+ ms << "<mover accent='false'>" << cell(1) << cell(0) << "</mover>";
+}
+
+
+void InsetMathStackrel::htmlize(HtmlStream & os) const
+{
+ if (nargs() > 2) {
+ os << MTag("span", "class='underoverset'")
+ << MTag("span", "class='top'") << cell(0) << ETag("span")
+ << MTag("span") << cell(1) << ETag("span")
+ << MTag("span", "class='bottom'") << cell(2) << ETag("span");
+ } else {
+ // at the moment, this is exactly the same as overset
+ os << MTag("span", "class='overset'")
+ << MTag("span", "class='top'") << cell(0) << ETag("span")
+ << MTag("span") << cell(1) << ETag("span");
+ }
+ os << ETag("span");
+}
+
+
+void InsetMathStackrel::validate(LaTeXFeatures & features) const
+{
+ if (features.runparams().math_flavor == OutputParams::MathAsHTML) {
+ if (nargs() > 2) {
+ // FIXME: "vertical-align: middle" works only if the
+ // height of sub and super script is approximately equal.
+ features.addCSSSnippet(
+ "span.underoverset{display: inline-block; vertical-align: middle; text-align:center;}\n"
+ "span.underoverset span {display: block;}\n"
+ "span.bottom{font-size: 66%;}\n"
+ "span.top{font-size: 66%;}");
+ } else {
+ // from overset
+ features.addCSSSnippet(
+ "span.overset{display: inline-block; vertical-align: bottom; text-align:center;}\n"
+ "span.overset span {display: block;}\n"
+ "span.top{font-size: 66%;}");
+ }
+ }
+ if (nargs() > 2)
+ features.require("stackrel");
+
+ InsetMathNest::validate(features);
+}
+