See http://bugzilla.lyx.org/show_bug.cgi?id=2932. This goes in tomorrow unless I get objections.
Georg
Index: src/mathed/InsetMathGrid.C =================================================================== --- src/mathed/InsetMathGrid.C (Revision 17470) +++ src/mathed/InsetMathGrid.C (Arbeitskopie) @@ -113,7 +113,7 @@ InsetMathGrid::CellInfo::CellInfo() InsetMathGrid::RowInfo::RowInfo() - : lines_(0), skip_(0) + : lines_(0), skip_(0), allow_pagebreak_(true) {} @@ -616,6 +616,8 @@ docstring InsetMathGrid::eolString(row_t if (!rowinfo_[row].crskip_.zero()) eol += '[' + from_utf8(rowinfo_[row].crskip_.asLatexString()) + ']'; + else if(!rowinfo_[row].allow_pagebreak_) + eol += '*'; // make sure an upcoming '[' does not break anything if (row + 1 < nrows()) { Index: src/mathed/InsetMathGrid.h =================================================================== --- src/mathed/InsetMathGrid.h (Revision 17470) +++ src/mathed/InsetMathGrid.h (Arbeitskopie) @@ -62,6 +62,8 @@ public: LyXLength crskip_; /// extra distance between lines int skip_; + /// Is a page break allowed after this row? + bool allow_pagebreak_; }; // additional per-row information Index: src/mathed/MathParser.C =================================================================== --- src/mathed/MathParser.C (Revision 17470) +++ src/mathed/MathParser.C (Arbeitskopie) @@ -111,7 +111,7 @@ bool stared(docstring const & s) * environments like "equation" that have a fixed number of rows. */ bool addRow(InsetMathGrid & grid, InsetMathGrid::row_type & cellrow, - docstring const & vskip) + docstring const & vskip, bool allow_pagebreak = true) { ++cellrow; if (cellrow == grid.nrows()) { @@ -128,11 +128,14 @@ bool addRow(InsetMathGrid & grid, InsetM lyxerr << "ignoring extra row"; if (!vskip.empty()) lyxerr << " with extra space " << to_utf8(vskip); + if (!allow_pagebreak) + lyxerr << " with no page break allowed"; lyxerr << '.' << endl; return false; } } grid.vcrskip(LyXLength(to_utf8(vskip)), cellrow - 1); + grid.rowinfo(cellrow - 1).allow_pagebreak_ = allow_pagebreak; return true; } @@ -1013,7 +1016,13 @@ void Parser::parse1(InsetMathGrid & grid else if (t.cs() == "\\") { if (flags & FLAG_ALIGN) return; - if (addRow(grid, cellrow, getArg('[', ']'))) { + bool added; + if (nextToken().asInput() == "*") { + getToken(); + added = addRow(grid, cellrow, docstring(), false); + } else + added = addRow(grid, cellrow, getArg('[', ']')); + if (added) { cellcol = 0; if (grid.asHullInset()) grid.asHullInset()->numbered(