#include <config.h>
+#include "InsetMathScript.h"
+
+#include "InsetMathBrace.h"
+#include "InsetMathSymbol.h"
+#include "MathData.h"
+#include "MathStream.h"
+#include "MathSupport.h"
+
#include "BufferView.h"
#include "Cursor.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "InsetMathBrace.h"
-#include "InsetMathScript.h"
-#include "InsetMathSymbol.h"
#include "LaTeXFeatures.h"
-#include "MathData.h"
-#include "MathStream.h"
-#include "MathSupport.h"
+#include "MetricsInfo.h"
#include "support/debug.h"
#include "support/gettext.h"
-
#include "support/lassert.h"
{
if (nargs() == 3)
return cell(2);
- LBUFERR(nargs() > 1, _("Invalid number of math cells."));
+ LBUFERR(nargs() > 1);
return cell(1);
}
{
if (nargs() == 3)
return cell(2);
- LBUFERR(nargs() > 1, _("Invalid number of math cells."));
+ LBUFERR(nargs() > 1);
return cell(1);
}
MathData const & InsetMathScript::up() const
{
- LBUFERR(nargs() > 1, _("Invalid number of math cells."));
+ LBUFERR(nargs() > 1);
return cell(1);
}
MathData & InsetMathScript::up()
{
- LBUFERR(nargs() > 1, _("Invalid number of math cells."));
+ LBUFERR(nargs() > 1);
return cell(1);
}
Dimension dim1;
Dimension dim2;
cell(0).metrics(mi, dim0);
- ScriptChanger dummy(mi.base);
+ Changer dummy = mi.base.changeScript();
if (nargs() > 1)
cell(1).metrics(mi, dim1);
if (nargs() > 2)
if (editing(&bv))
pi.draw(x + dxx(bv), y, char_type('.'));
}
- ScriptChanger dummy(pi.base);
+ Changer dummy = pi.base.changeScript();
if (hasUp())
up().draw(pi, x + dx1(bv), y - dy1(bv));
if (hasDown())
}
-// FIXME XHTML
-// It may be worth trying to output munder, mover, and munderover
-// in certain cases, e.g., for display formulas. But then we would
-// need to know if we're in a display formula.
void InsetMathScript::mathmlize(MathStream & os) const
{
bool d = hasDown() && !down().empty();
bool u = hasUp() && !up().empty();
+ bool l = hasLimits();
if (u && d)
- os << MTag("msubsup");
+ os << MTag(l ? "munderover" : "msubsup");
else if (u)
- os << MTag("msup");
+ os << MTag(l ? "mover" : "msup");
else if (d)
- os << MTag("msub");
+ os << MTag(l ? "munder" : "msub");
if (!nuc().empty())
os << MTag("mrow") << nuc() << ETag("mrow");
if (u && d)
os << MTag("mrow") << down() << ETag("mrow")
<< MTag("mrow") << up() << ETag("mrow")
- << ETag("msubsup");
+ << ETag(l ? "munderover" : "msubsup");
else if (u)
- os << MTag("mrow") << up() << ETag("mrow") << ETag("msup");
+ os << MTag("mrow") << up() << ETag("mrow") << ETag(l ? "mover" : "msup");
else if (d)
- os << MTag("mrow") << down() << ETag("mrow") << ETag("msub");
+ os << MTag("mrow") << down() << ETag("mrow") << ETag(l ? "munder" : "msub");
}