On Wed, Nov 30, 2016 at 05:23:59PM +0100, Enrico Forestieri wrote: > On Wed, Nov 30, 2016 at 10:40:09AM -0500, Scott Kostyshak wrote: > > > > Thanks for the explanations. It seems we should report the LyX display > > bug you mention above, and then just not worry about the compilation > > failures. > > I found that enclosing the nested macros in brace insets circumvents > both issues (display glitch and latex error). Unfortunately, lyx duly > removes the braces when reloading the document, so that this only > takes care of the display issue, in practice. See attached.
The attached patch fixes the display glitch for me. > So, the conclusion is that the error is actually due to a limitation > of xkeyval. The only way to avoid this error still remains enclosing a nested macro and its parameters in a brace inset. However, this workaround will be frustrated by lyx on reloading the document. -- Enrico
diff --git a/src/mathed/MathData.cpp b/src/mathed/MathData.cpp index f2100af..44a5055 100644 --- a/src/mathed/MathData.cpp +++ b/src/mathed/MathData.cpp @@ -659,12 +659,15 @@ void MathData::collectOptionalParameters(Cursor * cur, if (operator[](pos)->getChar() != '[') break; - // found possible optional argument, look for "]" + // found possible optional argument, look for pairing "]" + int count = 1; size_t right = pos + 1; for (; right < size(); ++right) { MathAtom & cell = operator[](right); - if (cell->getChar() == ']') + if (cell->getChar() == '[') + ++count; + else if (cell->getChar() == ']' && --count == 0) // found right end break;