}
-docstring InsetMathGrid::eolString(row_type row, bool fragile,
+void InsetMathGrid::eol(TeXMathStream & os, row_type row, bool fragile,
bool /*latex*/, bool last_eoln) const
{
docstring eol;
// only add \\ if necessary
if (eol.empty() && row + 1 == nrows() && (nrows() == 1 || !last_eoln))
- return docstring();
+ return;
- return (fragile ? "\\protect\\\\" : "\\\\") + eol;
+ os << (fragile ? "\\protect\\\\" : "\\\\") << eol;
}
row_type end_row, col_type end_col) const
{
MathEnsurer ensurer(os, false);
- docstring eol;
+ docstring eolstr;
+ // 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,
os << eocString(col + nccols - 1, lastcol);
col += nccols;
}
- eol = eolString(row, os.fragile(), os.latex(), last_eoln);
- os << eol;
+ eol(os, row, fragile, os.latex(), last_eoln);
// append newline only if line wasn't completely empty
// and the formula is not written on a single line
- bool const empty = emptyline && eol.empty();
+ bool const empty = emptyline && eolstr.empty();
if (!empty && nrows() > 1)
os << "\n";
}
// @TODO use end_row instead of nrows() ?
docstring const s = verboseHLine(rowinfo_[nrows()].lines);
if (!s.empty()) {
- if (eol.empty()) {
- if (os.fragile())
+ if (eolstr.empty()) {
+ if (fragile)
os << "\\protect";
os << "\\\\";
}
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())