]> git.lyx.org Git - features.git/commit
Implement properly \limits and \nolimits
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sun, 19 Jul 2020 17:56:07 +0000 (19:56 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 20 Jul 2020 21:20:26 +0000 (23:20 +0200)
commitf96b99dcb3527405ebe9165c13d5e7c0955f9af0
treeaa9990df3c492011d8c98a6f186cdc7b1c02313d
parent1dbc50a30d34c4e394ffad06715a88af444ade62
Implement properly \limits and \nolimits

These are now properties of insets that can be operators :
InsetMathSymbols, InsetMathDecoration (for over/underbrace) and
InsetMathMacro (for its contents).

Each of these has a limit_ member that allows to remember a limit
forcing and a member defaultLimits() that indicates what to do in the
absence of such forcing. Moreover the write() method calls
writeLimits().

This allows to simplify the definitions of integrals in lib/symbols by
defining the integrals as macros of their "op" version, as it is done in
the style files.

Also, many hardcoded assumptions can now be removed.

The handling of LFUN_MATH_LIMITS is now done in InsetNest, which tries
successively to apply the limit change to (1) the character after
cursor, (2) the character before cursor and (3) the character at the
end of the inset (useful for script insets?)

The new code allows to define
  \newcommand\int{\intop\limits}
but not
  \newcommand\makelimits#1{#1\limits}

It is also possible to type explicitly \limits or \nolimits to modify
a symbol.
15 files changed:
lib/symbols
src/mathed/InsetMath.cpp
src/mathed/InsetMath.h
src/mathed/InsetMathDecoration.cpp
src/mathed/InsetMathDecoration.h
src/mathed/InsetMathMacro.cpp
src/mathed/InsetMathMacro.h
src/mathed/InsetMathNest.cpp
src/mathed/InsetMathScript.cpp
src/mathed/InsetMathScript.h
src/mathed/InsetMathSymbol.cpp
src/mathed/InsetMathSymbol.h
src/mathed/MathData.cpp
src/mathed/MathData.h
src/mathed/MathParser.cpp