]> git.lyx.org Git - lyx.git/commitdiff
* src/mathed/MathParser.C
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Fri, 3 Nov 2006 15:05:14 +0000 (15:05 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Fri, 3 Nov 2006 15:05:14 +0000 (15:05 +0000)
(Parser::parse1): Fix special handling of {}-bases to not destroy
\xxx{\vec{H}}_0 where \xxx is an unknown command

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15712 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/MathParser.C

index c3a17c2875b72b2bf7d4706754789b307f444fd7..2fe641cf93c659cca2eaf4641fcfbfacc565ad7d 100644 (file)
@@ -816,9 +816,13 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
                                cell->back() = MathAtom(new InsetMathScript(cell->back(), up));
                        InsetMathScript * p = cell->back().nucleus()->asScriptInset();
                        // special handling of {}-bases
+                       // Test for empty brace inset, otherwise \xxx{\vec{H}}_{0}
+                       // where \xxx is an unknown command gets misparsed to
+                       // \xxx\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() &&
+                           p->nuc().back()->asBraceInset()->cell(0).empty())
                                p->nuc() = p->nuc().back()->asNestInset()->cell(0);
                        parse(p->cell(p->idxOfScript(up)), FLAG_ITEM, mode);
                        if (limits) {