]> git.lyx.org Git - lyx.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:07:08 +0000 (00:07 +0200)
commit25678dae120fd968eb2a21ff5e81324bcd5dc083
tree5b6e08f09a217a9e78e92976908572a481b715f0
parent080c068e971a7a194e5a6db6b8a6bdb717fbcbae
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.

(cherry picked from commit 767f0df18fcd61611de1d1e10e0fd1867479fb59)
src/mathed/InsetMathMacro.cpp
src/mathed/InsetMathMacro.h