]> git.lyx.org Git - features.git/blobdiff - src/mathed/MathParser.cpp
Native support for \smash[t] and \smash[b]
[features.git] / src / mathed / MathParser.cpp
index 1c7f2ff0ad3abc79a452d187f29378c3eb4d7a15..234bfd8728c0367f6eaee30840588703ff981112 100644 (file)
@@ -1849,16 +1849,22 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
                        skipSpaces();
                        if (nextToken().asInput() == "[") {
                                // Since the phantom inset cannot handle optional arguments
-                               // we must not create an InsetMathPhantom (bug 8967).
+                               // other than b and t, we must not create an InsetMathPhantom
+                               // if opt is different from b and t (bug 8967).
                                docstring const opt = parse_verbatim_option();
-                               docstring const arg = parse_verbatim_item();
-                               cell->push_back(MathAtom(new MathMacro(buf, t.cs())));
-                               MathData ar;
-                               mathed_parse_cell(ar, '[' + opt + ']', mode_);
-                               cell->append(ar);
-                               ar = MathData();
-                               mathed_parse_cell(ar, '{' + arg + '}', mode_);
-                               cell->append(ar);
+                               if (opt == "t" || opt == "b") {
+                                       cell->push_back(createInsetMath(t.cs() + opt, buf));
+                                       parse(cell->back().nucleus()->cell(0), FLAG_ITEM, mode);
+                               } else {
+                                       docstring const arg = parse_verbatim_item();
+                                       cell->push_back(MathAtom(new MathMacro(buf, t.cs())));
+                                       MathData ar;
+                                       mathed_parse_cell(ar, '[' + opt + ']', mode_);
+                                       cell->append(ar);
+                                       ar = MathData();
+                                       mathed_parse_cell(ar, '{' + arg + '}', mode_);
+                                       cell->append(ar);
+                               }
                        }
                        else {
                                cell->push_back(createInsetMath(t.cs(), buf));