[LyX/master] Avoid double superscript errors

Enrico Forestieri forenr at lyx.org
Fri Feb 5 00:01:06 UTC 2021


commit 5ed01cd6167233e0926d02cdab862dc12873c9b2
Author: Enrico Forestieri <forenr at lyx.org>
Date:   Fri Feb 5 01:03:09 2021 +0100

    Avoid double superscript errors
    
    Fixes #1633
---
 src/mathed/InsetMathScript.cpp |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mathed/InsetMathScript.cpp b/src/mathed/InsetMathScript.cpp
index 01c91a3..5d522bb 100644
--- a/src/mathed/InsetMathScript.cpp
+++ b/src/mathed/InsetMathScript.cpp
@@ -509,9 +509,12 @@ void InsetMathScript::write(TeXMathStream & os) const
 {
 	MathEnsurer ensurer(os);
 
-	if (!nuc().empty())
+	if (!nuc().empty()) {
 		os << nuc();
-	else if (os.firstitem())
+		// Avoid double superscript errors (bug #1633)
+		if (os.latex() && hasUp() && nuc().back()->getChar() == '\'')
+			os << "{}";
+	} else if (os.firstitem())
 		LYXERR(Debug::MATHED, "suppressing {} when writing");
 	else
 		os << "{}";


More information about the lyx-cvs mailing list