]> git.lyx.org Git - features.git/blobdiff - src/mathed/InsetMathGrid.cpp
Revert part of 503c7c16: InsetMathNest:edit resets anchor.
[features.git] / src / mathed / InsetMathGrid.cpp
index 4dbd8a1bdc387d7ce5bd1ee8608ea63e1435b752..96ec13b954b67ee9806a37e08cc0d4aba7491e6a 100644 (file)
@@ -1248,6 +1248,11 @@ void InsetMathGrid::write(TeXMathStream & os,
 {
        MathEnsurer ensurer(os, false);
        docstring eol;
+       // As of 2018 (with amendment in LaTeX 2021/06),
+       // \\ is a robust command and its protection
+       // is no longer necessary
+       bool const fragile = os.fragile()
+                       && !LaTeXFeatures::isAvailable("LaTeX-2021/06/01");
        for (row_type row = beg_row; row < end_row; ++row) {
                os << verboseHLine(rowinfo_[row].lines);
                // don't write & and empty cells at end of line,
@@ -1294,7 +1299,7 @@ void InsetMathGrid::write(TeXMathStream & os,
                        os << eocString(col + nccols - 1, lastcol);
                        col += nccols;
                }
-               eol = eolString(row, os.fragile(), os.latex(), last_eoln);
+               eol = eolString(row, fragile, os.latex(), last_eoln);
                os << eol;
                // append newline only if line wasn't completely empty
                // and the formula is not written on a single line
@@ -1306,7 +1311,7 @@ void InsetMathGrid::write(TeXMathStream & os,
        docstring const s = verboseHLine(rowinfo_[nrows()].lines);
        if (!s.empty()) {
                if (eol.empty()) {
-                       if (os.fragile())
+                       if (fragile)
                                os << "\\protect";
                        os << "\\\\";
                }
@@ -1566,7 +1571,8 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
                        idocstringstream is(cmd.argument());
                        int n = 0;
                        is >> n;
-                       topaste = cap::selection(n, buffer().params().documentClassPtr());
+                       topaste = cap::selection(n, make_pair(buffer().params().documentClassPtr(),
+                                                             buffer().params().authors()), true);
                }
                InsetMathGrid grid(buffer_, 1, 1);
                if (!topaste.empty())