Jean-Marc Lasgouttes wrote:
>>>>>> "Georg" == Georg Baum
>>>>>> <[EMAIL PROTECTED]>
>>>>>> writes:
>
> Georg> I don't think that that will work. What does work for me is to
> Georg> test the previous inset: If it is unknown, do not remove the
> Georg> braces.
>
> And what about \xxx{aa}{bb}^2
Indeed we have also to test for brace insets...
> It seems difficult to find a good solution, actually.
Yes. I don't like it very much, but I don't see how we could do better. The
principal problem is that we can't know for sure whether the braces are
needed because of a previous command or not. What about this version?
Georg
Index: src/mathed/math_parser.C
===================================================================
--- src/mathed/math_parser.C (Revision 15635)
+++ src/mathed/math_parser.C (Arbeitskopie)
@@ -813,10 +813,20 @@ void Parser::parse1(MathGridInset & grid
else
cell->back() = MathAtom(new MathScriptInset(cell->back(), up));
MathScriptInset * p = cell->back().nucleus()->asScriptInset();
- // special handling of {}-bases
+ // special handling of {}-bases like in {a'}^2.
+ // We need to kill the brace inset in this case, but
+ // we must not kill it if it follows an unknown
+ // command \xxx like in \xxx{\vec{H}}_{0}, or
+ // \yyy{aaa}{\vec{H}}_{0} otherwise
+ // the unknown command gets misparsed to
+ // \xxx\vec{H}_{0} or \yyy{aaa}\vec{H}_{0}, and that
+ // is invalid LaTeX.
// is this always correct?
- if (p->nuc().size() == 1
- && p->nuc().back()->asBraceInset())
+ if (p->nuc().size() == 1 &&
+ p->nuc().back()->asBraceInset() &&
+ !(cell->size() > 1 &&
+ ((*cell)[cell->size()-2]->asUnknownInset() ||
+ (*cell)[cell->size()-2]->asBraceInset())))
p->nuc() = p->nuc().back()->asNestInset()->cell(0);
parse(p->cell(p->idxOfScript(up)), FLAG_ITEM, mode);
if (limits) {