[LyX/2.3.x] Fix bug #3294

Enrico Forestieri forenr at lyx.org
Sat Feb 27 22:27:10 UTC 2021


commit 999831043e6da50b3095a2dfec7000d4209e586c
Author: Enrico Forestieri <forenr at lyx.org>
Date:   Sat Feb 27 23:31:25 2021 +0100

    Fix bug #3294
---
 src/mathed/InsetMathRoot.cpp |    8 +++++++-
 status.23x                   |    3 +++
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/mathed/InsetMathRoot.cpp b/src/mathed/InsetMathRoot.cpp
index 3cc8e2e..f0b8912 100644
--- a/src/mathed/InsetMathRoot.cpp
+++ b/src/mathed/InsetMathRoot.cpp
@@ -22,6 +22,8 @@
 
 #include "frontends/Painter.h"
 
+#include "support/lstrings.h"
+
 
 using namespace std;
 
@@ -134,7 +136,11 @@ void InsetMathRoot::draw(PainterInfo & pi, int x, int y) const
 void InsetMathRoot::write(WriteStream & os) const
 {
 	MathEnsurer ensurer(os);
-	os << "\\sqrt[" << cell(0) << "]{" << cell(1) << '}';
+	if (os.latex() && !cell(0).empty() && !cell(0).front()->asBraceInset()
+	    && support::contains(asString(cell(0)), '['))
+		os << "\\sqrt[{" << cell(0) << "}]{" << cell(1) << '}';
+	else
+		os << "\\sqrt[" << cell(0) << "]{" << cell(1) << '}';
 }
 
 
diff --git a/status.23x b/status.23x
index 05fbdef..027bd7e 100644
--- a/status.23x
+++ b/status.23x
@@ -60,6 +60,9 @@ What's new
   immediately following nested itemize environment when loading documents
   created with version 2.1 or earlier (bug 12148).
 
+- Fix export of the optional argument of \sqrt when it contains other
+  commands with optional arguments (bug 3294).
+
 
 * USER INTERFACE
 


More information about the lyx-cvs mailing list