[LyX/master] Amend 148efdf6

Enrico Forestieri forenr at lyx.org
Sun Sep 14 09:22:33 UTC 2025


commit 55f10d7f1a9ec6cd8d0e7c8fa453dbb84fcbf3a7
Author: Enrico Forestieri <forenr at lyx.org>
Date:   Sun Sep 14 11:17:10 2025 +0200

    Amend 148efdf6
    
    Empty braces are also necessary when we have a subscript
    that follows a prime (which is an implicit superscript).
    Part of #13004.
---
 src/mathed/InsetMathScript.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/mathed/InsetMathScript.cpp b/src/mathed/InsetMathScript.cpp
index 47d8459ecf..1ccdf4f3cc 100644
--- a/src/mathed/InsetMathScript.cpp
+++ b/src/mathed/InsetMathScript.cpp
@@ -13,6 +13,7 @@
 #include "InsetMathScript.h"
 
 #include "InsetMathBrace.h"
+#include "InsetMathChar.h"
 #include "MathData.h"
 #include "MathStream.h"
 #include "MathSupport.h"
@@ -531,7 +532,9 @@ void InsetMathScript::writeMath(TeXMathStream & os) const
 
 	// Avoid double superscript errors by writing an
 	// empty group {} when a prime immediately follows
-	if (os.latex() && hasUp())
+	if (os.latex() && (hasUp() ||
+	    (hasDown() && !nuc().empty() && nuc().back()->asCharInset() &&
+	     nuc().back()->asCharInset()->getChar() == '\'')))
 		os.useBraces(true);
 
 	if (lock_ && !os.latex())


More information about the lyx-cvs mailing list