[EMAIL PROTECTED] wrote:
Author: forenr
Date: Mon Jun 16 03:21:17 2008
New Revision: 25270

URL: http://www.lyx.org/trac/changeset/25270
Log:
Fix bug 1527
http://bugzilla.lyx.org/show_bug.cgi?id=1527

Modified: lyx-devel/trunk/src/mathed/CommandInset.cpp
==============================================================================
 void CommandInset::write(WriteStream & os) const
 {
+       bool brace = os.pendingBrace();
+       os.pendingBrace(false);
+       if (os.latex() && os.textMode() && needs_math_mode_) {
+               os << "\\ensuremath{";
+               os.textMode(false);
+       }
        os << '\\' << name_.c_str();
        if (cell(1).size())
                os << '[' << cell(1) << ']';
        os << '{' << cell(0) << '}';
+       os.pendingBrace(brace);

Maybe you could create a helper method in InsetMath to avoid the code repetition in all inset?

bool InsetMath::ensureMath(WriteStream & os)
{
        bool brace = os.pendingBrace();
        os.pendingBrace(false);
        if (os.latex() && os.textMode() && needs_math_mode_) {
                os << "\\ensuremath{";
                os.textMode(false);
        }
        return brace;
}

Abdel

Reply via email to