]> git.lyx.org Git - features.git/commit
Fix math mode for InsetMathMacro on output
authorGuillaume MM <gm@lyx.org>
Sun, 8 Oct 2017 21:21:10 +0000 (23:21 +0200)
committerGuillaume MM <gm@lyx.org>
Sun, 22 Oct 2017 22:08:19 +0000 (00:08 +0200)
commit6503073070c9d4f35961df68ebfc7cfaa2c39ab3
tree0781489245d9ca1221aca0847e251dc120054b30
parent032932cbee2f89f198dd1ce623188786f287e183
Fix math mode for InsetMathMacro on output

After 6642152e, user macros were no longer wrapped in \ensuremath. In 2.2 and
before, InsetMathMacro behaved as follow:

* Textmode global symbols are wrapped in \text when in math.

* Other global symbols, and user macros, are wrapped in \ensuremath when in
  text.

* Undefined macros (ERT) are wrapped neither in \text nor in \ensuremath.

This is also consistent with the documentation of MathEnsurer in
mathed/MathStream.h.

This patch defines InsetMathMacro::currentMode() accordingly (respectively
TEXT_MODE, MATH_MODE and UNDECIDED_MODE) and uses it to determine the output.

After this patch, there is a mismatch between screen and pdf output for user
macros in \text. This is not a regression wrt 2.2 and is because linearization
does not satisfy currentMode() currently.
src/mathed/InsetMathMacro.cpp
src/mathed/InsetMathMacro.h