X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2FInsetMathMacro.cpp;h=d2c35c7e5bea913e1d857fc319871945de87d0db;hb=d9082639080b9de993742bd352f92e5183058cf5;hp=c35226fd6ca41af04334bf29dbff975fe0e9ae81;hpb=9cb98136ceeb3fbda70aa5beea4cf3f5ea26a36c;p=lyx.git diff --git a/src/mathed/InsetMathMacro.cpp b/src/mathed/InsetMathMacro.cpp index c35226fd6c..d2c35c7e5b 100644 --- a/src/mathed/InsetMathMacro.cpp +++ b/src/mathed/InsetMathMacro.cpp @@ -169,7 +169,7 @@ public: /// 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_); } /// @@ -398,14 +398,14 @@ bool InsetMathMacro::allowsLimitsChange() const } -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; } @@ -1133,7 +1133,7 @@ bool InsetMathMacro::folded() const } -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); @@ -1214,8 +1214,11 @@ void InsetMathMacro::write(WriteStream & os) const } // 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); @@ -1240,7 +1243,7 @@ void InsetMathMacro::mathematica(MathematicaStream & os) const } -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);