[LyX/master] Do not protect \\ as of LaTeX 2021/06/01

Juergen Spitzmueller spitz at lyx.org
Mon Dec 27 15:03:33 UTC 2021


commit a7905c5b960cc07ddc801cbc217600e5cd4812f0
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Mon Dec 27 16:31:09 2021 +0100

    Do not protect \\ as of LaTeX 2021/06/01
---
 lib/chkconfig.ltx            |    2 ++
 src/mathed/InsetMathGrid.cpp |   12 +++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx
index 3512887..fe3ce0d 100644
--- a/lib/chkconfig.ltx
+++ b/lib/chkconfig.ltx
@@ -240,6 +240,8 @@
 % This introduces all math and text spaces
 % previously only available via amsmath
 \TestLaTeXVersion{2020/10/01}
+% This robustifies LaTeX commands
+\TestLaTeXVersion{2021/06/01}
 
 %%% And now, the list of available languages
 % The trick is to know that \the\everyjob contains something like
diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp
index aa60d6a..f180b9a 100644
--- a/src/mathed/InsetMathGrid.cpp
+++ b/src/mathed/InsetMathGrid.cpp
@@ -772,9 +772,6 @@ docstring InsetMathGrid::eolString(row_type row, bool fragile,
 	if (eol.empty() && row + 1 == nrows() && (nrows() == 1 || !last_eoln))
 		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;
 }
 
@@ -1251,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 = LaTeXFeatures::isAvailable("LaTeX-2021/06/01") ?
+		false : os.fragile();
 	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,
@@ -1297,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
@@ -1309,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 << "\\\\";
 		}


More information about the lyx-cvs mailing list