#include "frontends/Painter.h"
#include "support/lassert.h"
+#include "support/lstrings.h"
using namespace std;
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) << '}';
}