commit 195b928f92d5e00874f64fffa21852cdef80bc10
Author: Enrico Forestieri <[email protected]>
Date:   Sat Feb 27 14:49:55 2021 +0100

    Fix bug #3294
---
 src/mathed/InsetMathRoot.cpp |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/mathed/InsetMathRoot.cpp b/src/mathed/InsetMathRoot.cpp
index 2c90e5b..6de085f 100644
--- a/src/mathed/InsetMathRoot.cpp
+++ b/src/mathed/InsetMathRoot.cpp
@@ -23,6 +23,7 @@
 #include "frontends/Painter.h"
 
 #include "support/lassert.h"
+#include "support/lstrings.h"
 
 using namespace std;
 
@@ -135,7 +136,11 @@ void InsetMathRoot::draw(PainterInfo & pi, int x, int y) 
const
 void InsetMathRoot::write(TeXMathStream & os) const
 {
        MathEnsurer ensurer(os);
-       os << "\\sqrt[" << cell(1) << "]{" << cell(0) << '}';
+       if (os.latex() && !cell(1).empty() && !cell(1).front()->asBraceInset()
+           && support::contains(asString(cell(1)), '['))
+               os << "\\sqrt[{" << cell(1) << "}]{" << cell(0) << '}';
+       else
+               os << "\\sqrt[" << cell(1) << "]{" << cell(0) << '}';
 }
 
 
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to