lyx_mirror/src/mathed
Enrico Forestieri 9435dd6b52 Fix display and output of math macros with optional arguments
This is a long standing issue, present since the new math macros
inception in version 1.6. It manifests as a display issue when a
macro with optional arguments appears in the optional argument of
another macro. In this case the display is messed up and it is
difficult, if not impossible, changing the arguments as they do not
appear on screen as related to a specific macro instance. It also
manifests as latex errors when compiling, even if the latex output
is formally correct, due to limitations of the xargs package used
to output the macros. Most probably, both aspects have the same
root cause, as simply enclosing in braces the macro and its
parameters solves both issues. However, when reloading a document,
lyx strips the outer braces enclosing a macro argument, thus
frustrating this possible workaround.

This commit solves the display issue by correctly accounting for
macros with optional arguments nested in the argument of another
macro, and circumvents the xargs package limitations causing errors
by enclosing in braces the macros with optional arguments appearing
in the argument of an outer macro when they are output. This means
that when loading an old document with such macros and saving it
again, the macro representation is updated and will have these
additional braces. However, as such braces are stripped by lyx on
loading, there is no risk that they accumulate.

See also this thread:
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg197828.html
2016-12-04 22:52:22 +01:00
..
BUGS Improve math-mode lfun for switching to text 2015-08-23 11:10:05 +02:00
CMakeLists.txt Fix building with cmake and Qt4 2015-06-11 00:09:31 +02:00
CommandInset.cpp
CommandInset.h
InsetMath.cpp Adding TexRow information on math latex output (#4725) 2015-10-19 06:55:17 +01:00
InsetMath.h Sanitize InsetMathHull and add a check for mutability in LFUN_MATH_MUTATE 2016-06-15 22:32:52 +01:00
InsetMathAMSArray.cpp New LFUN tabular-feature (#9794) 2016-01-27 18:20:37 +01:00
InsetMathAMSArray.h
InsetMathArray.cpp Adding TexRow information on math latex output (#4725) 2015-10-19 06:55:17 +01:00
InsetMathArray.h
InsetMathBig.cpp Use symbols file to lookup entities for delimiters. Fixes bug #8280. 2016-06-29 22:42:03 -04:00
InsetMathBig.h Remove some header leftovers based on Scott's script hints. 2013-05-02 00:30:16 -07:00
InsetMathBoldSymbol.cpp
InsetMathBoldSymbol.h
InsetMathBox.cpp Inset files: add includes to compile with cxx11 2015-12-10 01:15:16 +01:00
InsetMathBox.h Remove some header leftovers based on Scott's script hints. 2013-05-02 00:30:16 -07:00
InsetMathBrace.cpp std::min/max are defined in <algorithm> 2014-06-07 08:17:20 +02:00
InsetMathBrace.h
InsetMathCancel.cpp
InsetMathCancel.h
InsetMathCancelto.cpp Convert remaining C++ files to UTF-8 2015-12-05 19:33:24 +00:00
InsetMathCancelto.h Convert remaining C++ files to UTF-8 2015-12-05 19:33:24 +00:00
InsetMathCases.cpp Fix CSS for math cases. 2016-07-31 03:42:38 -04:00
InsetMathCases.h Correct col spacing in Cases environment 2016-06-15 22:32:52 +01:00
InsetMathChar.cpp Introduce proper integer rounding function 2016-02-17 21:42:37 +01:00
InsetMathChar.h
InsetMathColor.cpp In mathed, require xcolor instead of color when appropriate 2016-10-27 03:18:29 +02:00
InsetMathColor.h Header cleanup cont. 2013-05-23 22:12:29 -07:00
InsetMathComment.cpp Fix bug #6466 2015-08-23 11:47:37 +02:00
InsetMathComment.h Fix bug #6466 2015-08-23 11:47:37 +02:00
InsetMathDecoration.cpp Add some missing member variable initializations 2015-09-13 19:47:21 +02:00
InsetMathDecoration.h
InsetMathDelim.cpp Use symbols file to lookup entities for delimiters. Fixes bug #8280. 2016-06-29 22:42:03 -04:00
InsetMathDelim.h Remove some header leftovers based on Scott's script hints. 2013-05-02 00:30:16 -07:00
InsetMathDiagram.cpp Adding TexRow information on math latex output (#4725) 2015-10-19 06:55:17 +01:00
InsetMathDiagram.h Header cleanup cont. 2013-05-25 16:38:20 -07:00
InsetMathDiff.cpp
InsetMathDiff.h
InsetMathDots.cpp Add missing intializations 2015-10-10 21:04:28 +02:00
InsetMathDots.h
InsetMathEnsureMath.cpp
InsetMathEnsureMath.h
InsetMathEnv.cpp mathed: bformat infoize messages 2014-11-14 18:18:30 +01:00
InsetMathEnv.h Remove some header leftovers based on Scott's script hints. 2013-05-02 00:30:16 -07:00
InsetMathExFunc.cpp
InsetMathExFunc.h Remove some header leftovers based on Scott's script hints. 2013-05-02 00:30:16 -07:00
InsetMathExInt.cpp
InsetMathExInt.h
InsetMathFont.cpp Add class attribute for \mathbb in XHTML output. Fixes part of 8251. 2016-06-29 23:02:28 -04:00
InsetMathFont.h
InsetMathFontOld.cpp mathed: bformat infoize messages 2014-11-14 18:18:30 +01:00
InsetMathFontOld.h
InsetMathFrac.cpp Fix comments 2015-06-11 20:40:04 +02:00
InsetMathFrac.h Replacement for commits bc47054b and ad0d0f6d 2015-06-14 18:10:29 +02:00
InsetMathGrid.cpp Set vertical lines in math arrays correctly on Y axis 2016-09-09 09:56:44 +02:00
InsetMathGrid.h Fix HTML display of math matrices. 2016-07-31 03:41:13 -04:00
InsetMathHull.cpp Strike out (in the output) deleted display math with track-changes 2016-11-05 21:31:09 +01:00
InsetMathHull.h Strike out (in the output) deleted display math with track-changes 2016-11-05 21:31:09 +01:00
InsetMathKern.cpp Improve support for on screen length calculation 2015-03-26 17:10:15 +01:00
InsetMathKern.h
InsetMathLefteqn.cpp
InsetMathLefteqn.h
InsetMathLim.cpp
InsetMathLim.h
InsetMathMatrix.cpp Parse \multicolumn in math (bug 396) 2015-05-17 13:43:37 +02:00
InsetMathMatrix.h
InsetMathNest.cpp Strike out (in the output) deleted display math with track-changes 2016-11-05 21:31:09 +01:00
InsetMathNest.h Fix the last clang warnings about overloaded virtual methods 2014-12-22 11:02:45 +01:00
InsetMathNumber.cpp
InsetMathNumber.h
InsetMathOverset.cpp
InsetMathOverset.h
InsetMathPar.cpp
InsetMathPar.h
InsetMathPhantom.cpp Inset files: add includes to compile with cxx11 2015-12-10 01:15:16 +01:00
InsetMathPhantom.h Native support for \smash[t] and \smash[b] 2014-05-27 22:13:58 +02:00
InsetMathRef.cpp
InsetMathRef.h
InsetMathRoot.cpp
InsetMathRoot.h
InsetMathScript.cpp Fix bug #8784 (mathml export for scripts) 2014-02-22 19:01:20 +01:00
InsetMathScript.h
InsetMathSideset.cpp Remove dead code 2015-09-13 14:05:49 +02:00
InsetMathSideset.h Remove ; from end of function definitions 2013-05-12 13:04:18 +02:00
InsetMathSize.cpp Fix silly error outputting math sizes. Fixes bug #10129. 2016-06-11 00:50:36 -04:00
InsetMathSize.h
InsetMathSpace.cpp Improve support for on screen length calculation 2015-03-26 17:10:15 +01:00
InsetMathSpace.h
InsetMathSpecialChar.cpp
InsetMathSpecialChar.h
InsetMathSplit.cpp Fix data loss with [ in first cell of aligned 2016-09-12 20:56:05 +02:00
InsetMathSplit.h Fix the display of column spacing in AMS environments 2016-06-15 22:32:52 +01:00
InsetMathSqrt.cpp
InsetMathSqrt.h
InsetMathStackrel.cpp
InsetMathStackrel.h
InsetMathString.cpp Remove a deep copy of MathData in lyx::write 2015-10-19 06:55:18 +01:00
InsetMathString.h
InsetMathSubstack.cpp New LFUN tabular-feature (#9794) 2016-01-27 18:20:37 +01:00
InsetMathSubstack.h
InsetMathSymbol.cpp Introduce proper integer rounding function 2016-02-17 21:42:37 +01:00
InsetMathSymbol.h
InsetMathTabular.cpp Adding TexRow information on math latex output (#4725) 2015-10-19 06:55:17 +01:00
InsetMathTabular.h
InsetMathUnderset.cpp
InsetMathUnderset.h
InsetMathUnknown.cpp Add missing intializations 2015-10-10 21:04:28 +02:00
InsetMathUnknown.h Remove heavy includes 2014-11-30 12:52:01 +01:00
InsetMathXArrow.cpp Inset files: add includes to compile with cxx11 2015-12-10 01:15:16 +01:00
InsetMathXArrow.h
InsetMathXYArrow.cpp Add missing intializations 2015-10-10 21:04:28 +02:00
InsetMathXYArrow.h
InsetMathXYMatrix.cpp Adding TexRow information on math latex output (#4725) 2015-10-19 06:55:17 +01:00
InsetMathXYMatrix.h
MacroTable.cpp Adding TexRow information on math latex output (#4725) 2015-10-19 06:55:17 +01:00
MacroTable.h Fix crash when copying a macro with instant preview on 2015-06-24 23:38:53 +02:00
MathAtom.cpp
MathAtom.h
MathAutoCorrect.cpp Remove unused methods in anononymous namespace 2016-10-26 15:15:54 +02:00
MathAutoCorrect.h
MathCompletionList.h
MathData.cpp Fix display and output of math macros with optional arguments 2016-12-04 22:52:22 +01:00
MathData.h Initialize MathData members 2015-09-12 22:47:09 +02:00
MathExtern.cpp Fix CAS input on windows (bug 10262) 2016-07-03 19:48:15 +02:00
MathExtern.h Remove a deep copy of MathData in lyx::write 2015-10-19 06:55:18 +01:00
MathFactory.cpp Remove unsupported macros from autocompletion 2015-03-10 20:53:56 +01:00
MathFactory.h
MathMacro.cpp Fix display and output of math macros with optional arguments 2016-12-04 22:52:22 +01:00
MathMacro.h Pimpl MathMacro 2015-04-02 21:20:32 +02:00
MathMacroArgument.cpp
MathMacroArgument.h
MathMacroTemplate.cpp Adding TexRow information on math latex output (#4725) 2015-10-19 06:55:17 +01:00
MathMacroTemplate.h Enhancements and bugfixes to the TOCs 2015-10-01 21:44:22 +01:00
MathParser_flags.h
MathParser.cpp Remove unused methods in anononymous namespace 2016-10-26 15:15:54 +02:00
MathParser.h Remove unsupported macros from autocompletion 2015-03-10 20:53:56 +01:00
MathStream.cpp Fix display and output of math macros with optional arguments 2016-12-04 22:52:22 +01:00
MathStream.h Fix display and output of math macros with optional arguments 2016-12-04 22:52:22 +01:00
MathSupport.cpp Adding TexRow information on math latex output (#4725) 2015-10-19 06:55:17 +01:00
MathSupport.h Improve support for on screen length calculation 2015-03-26 17:10:15 +01:00
README
ReplaceData.h
texify
TextPainter.cpp
TextPainter.h

Inset 'Xyz' is implemented by 'MathXyzInset' in 'math_xyzinset.[hC]'


Inset hierarchy:

                                   MathInset
                                (abstract base)

                         /            |               \

              Dim                  Char               Symbol, Space, ...
         (thing that need       (for things formerly
          the width_/ascent_     known as characters)
          /descent_ cache)

          /             \

       Nest              Dots,  Func, ...
  (for thing with
   nested content)

        |         \

      Grid        Decoration   Delim   Frac  Macro  Root  Script  Sqrt

      /   \

 Array    Hull
         (base for eqnarray/align/...)