Do not protect \\ as of LaTeX 2021/06/01

This commit is contained in:
Juergen Spitzmueller 2021-12-27 16:31:09 +01:00
parent faa404f063
commit a7905c5b96
2 changed files with 9 additions and 5 deletions

View File

@ -240,6 +240,8 @@
% This introduces all math and text spaces % This introduces all math and text spaces
% previously only available via amsmath % previously only available via amsmath
\TestLaTeXVersion{2020/10/01} \TestLaTeXVersion{2020/10/01}
% This robustifies LaTeX commands
\TestLaTeXVersion{2021/06/01}
%%% And now, the list of available languages %%% And now, the list of available languages
% The trick is to know that \the\everyjob contains something like % The trick is to know that \the\everyjob contains something like

View File

@ -772,9 +772,6 @@ docstring InsetMathGrid::eolString(row_type row, bool fragile,
if (eol.empty() && row + 1 == nrows() && (nrows() == 1 || !last_eoln)) if (eol.empty() && row + 1 == nrows() && (nrows() == 1 || !last_eoln))
return docstring(); return docstring();
// FIXME: As of 2018 (with amendment in LaTeX 2021/06),
// \\ is a robust command and the following protection
// is no longer necessary
return (fragile ? "\\protect\\\\" : "\\\\") + eol; return (fragile ? "\\protect\\\\" : "\\\\") + eol;
} }
@ -1251,6 +1248,11 @@ void InsetMathGrid::write(TeXMathStream & os,
{ {
MathEnsurer ensurer(os, false); MathEnsurer ensurer(os, false);
docstring eol; 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 = LaTeXFeatures::isAvailable("LaTeX-2021/06/01") ?
false : os.fragile();
for (row_type row = beg_row; row < end_row; ++row) { for (row_type row = beg_row; row < end_row; ++row) {
os << verboseHLine(rowinfo_[row].lines); os << verboseHLine(rowinfo_[row].lines);
// don't write & and empty cells at end of line, // don't write & and empty cells at end of line,
@ -1297,7 +1299,7 @@ void InsetMathGrid::write(TeXMathStream & os,
os << eocString(col + nccols - 1, lastcol); os << eocString(col + nccols - 1, lastcol);
col += nccols; col += nccols;
} }
eol = eolString(row, os.fragile(), os.latex(), last_eoln); eol = eolString(row, fragile, os.latex(), last_eoln);
os << eol; os << eol;
// append newline only if line wasn't completely empty // append newline only if line wasn't completely empty
// and the formula is not written on a single line // and the formula is not written on a single line
@ -1309,7 +1311,7 @@ void InsetMathGrid::write(TeXMathStream & os,
docstring const s = verboseHLine(rowinfo_[nrows()].lines); docstring const s = verboseHLine(rowinfo_[nrows()].lines);
if (!s.empty()) { if (!s.empty()) {
if (eol.empty()) { if (eol.empty()) {
if (os.fragile()) if (fragile)
os << "\\protect"; os << "\\protect";
os << "\\\\"; os << "\\\\";
} }