From 582fe0990f58625824a0e2521dac6905af897d9c Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Mon, 27 Dec 2021 11:42:30 +0100 Subject: [PATCH] \protect xymatrix in fragile context (\cprotect'ion not needed then). --- src/Paragraph.cpp | 1 - src/mathed/InsetMathXYMatrix.cpp | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 17c68fa98b..369bda0d7e 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -4126,7 +4126,6 @@ bool Paragraph::needsCProtection(bool const fragile) const continue; switch(im->cell(0)[0]->lyxCode()) { case MATH_ENV_CODE: - case MATH_XYMATRIX_CODE: // these need cprotection return true; default: diff --git a/src/mathed/InsetMathXYMatrix.cpp b/src/mathed/InsetMathXYMatrix.cpp index 7e35fe92e1..d8f54602b9 100644 --- a/src/mathed/InsetMathXYMatrix.cpp +++ b/src/mathed/InsetMathXYMatrix.cpp @@ -66,6 +66,8 @@ void InsetMathXYMatrix::draw(PainterInfo & pi, int x, int y) const void InsetMathXYMatrix::write(TeXMathStream & os) const { MathEnsurer ensurer(os); + if (os.fragile()) + os << "\\protect"; os << "\\xymatrix"; bool open = os.startOuterRow(); if (equal_spacing_) { -- 2.39.2