]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMath.cpp
Fix bug 5802 (http://bugzilla.lyx.org/show_bug.cgi?id=5802)
[lyx.git] / src / mathed / InsetMath.cpp
index dce8d598923f3d2be916bae4922a0b8b1a2aad20..139defa9b55b5d015b7ddba53a46490128ddb2b5 100644 (file)
@@ -4,7 +4,7 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Alejandro Aguilar Sierra
- * \author André Pönitz
+ * \author André Pönitz
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -68,19 +68,13 @@ void InsetMath::drawT(TextPainter &, int, int) const
 
 void InsetMath::write(WriteStream & os) const
 {
-       bool brace = os.pendingBrace();
-       os.pendingBrace(false);
-       if (os.latex() && os.textMode()) {
-               os << "\\ensuremath{";
-               os.textMode(false);
-       }
+       MathEnsurer ensurer(os);
        docstring const s = name();
        os << "\\" << s;
        // We need an extra ' ' unless this is a single-char-non-ASCII name
        // or anything non-ASCII follows
        if (s.size() != 1 || isAlphaASCII(s[0]))
                os.pendingSpace(true);
-       os.pendingBrace(brace);
 }