]> git.lyx.org Git - features.git/commitdiff
Fix bug #3294
authorEnrico Forestieri <forenr@lyx.org>
Sat, 27 Feb 2021 13:49:55 +0000 (14:49 +0100)
committerEnrico Forestieri <forenr@lyx.org>
Sat, 27 Feb 2021 13:49:55 +0000 (14:49 +0100)
src/mathed/InsetMathRoot.cpp

index 2c90e5ba5945b032050edab3bf4d55db83b270c3..6de085fc222c0aab283e2ffa7a01975c4b270eae 100644 (file)
@@ -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) << '}';
 }