///
void mathematica(MathematicaStream & ms) const override { ms << mathMacro_->cell(idx_); }
///
- void mathmlize(MathStream & ms) const override { ms << mathMacro_->cell(idx_); }
+ void mathmlize(MathMLStream & ms) const override { ms << mathMacro_->cell(idx_); }
///
void htmlize(HtmlStream & ms) const override { ms << mathMacro_->cell(idx_); }
///
}
-Limits InsetMathMacro::defaultLimits() const
+Limits InsetMathMacro::defaultLimits(bool display) const
{
if (d->expanded_.empty())
return NO_LIMITS;
// Guess from the expanded macro
InsetMath const * in = d->expanded_.back().nucleus();
Limits const lim = in->limits() == AUTO_LIMITS
- ? in->defaultLimits() : in->limits();
+ ? in->defaultLimits(display) : in->limits();
LATTEST(lim != AUTO_LIMITS);
return lim;
}
}
-void InsetMathMacro::write(WriteStream & os) const
+void InsetMathMacro::write(TeXMathStream & os) const
{
mode_type mode = currentMode();
MathEnsurer ensurer(os, mode == MATH_MODE, true, mode == TEXT_MODE);
}
// add space if there was no argument
- if (first)
+ // or add braces if we have optionals but none are present and [ follows
+ if (first) {
os.pendingSpace(true);
+ os.useBraces(d->optionals_ > 0);
+ }
// write \(no)limits modifiers if relevant
writeLimits(os);
}
-void InsetMathMacro::mathmlize(MathStream & ms) const
+void InsetMathMacro::mathmlize(MathMLStream & ms) const
{
// macro_ is 0 if this is an unknown macro
LATTEST(d->macro_ || d->displayMode_ != DISPLAY_NORMAL);