}
-void InsetMathScript::write(WriteStream & os) const
+void InsetMathScript::write(TeXMathStream & os) const
{
MathEnsurer ensurer(os);
- if (!nuc().empty())
+ if (!nuc().empty()) {
os << nuc();
- else if (os.firstitem())
+ // Avoid double superscript errors (bug 1633)
+ if (os.latex() && hasUp() && nuc().back()->getChar() == '\'')
+ os << "{}";
+ } else if (os.firstitem())
LYXERR(Debug::MATHED, "suppressing {} when writing");
else
os << "{}";
(up().size() == 1 && up().back()->asBraceInset() &&
up().back()->asBraceInset()->cell(0).empty())))
os << "^ {}";
- else
+ else {
os << "^{" << up() << '}';
+ // Avoid double superscript errors by writing an
+ // empty group {} when a prime immediately follows
+ if (os.latex())
+ os.useBraces(true);
+ }
}
if (lock_ && !os.latex())
}
-void InsetMathScript::mathmlize(MathStream & ms) const
+void InsetMathScript::mathmlize(MathMLStream & ms) const
{
bool d = hasDown() && !down().empty();
bool u = hasUp() && !up().empty();
- // FIXME: the MathStream should be able to give us this information
+ // FIXME: the MathMLStream should be able to give us this information
bool l = has_limits_;
if (u && d)