]> git.lyx.org Git - features.git/commitdiff
Fix bug #8889 by always issuing \protect in fragile environments.
authorEnrico Forestieri <forenr@lyx.org>
Sat, 22 Feb 2014 15:30:55 +0000 (10:30 -0500)
committerRichard Heck <rgheck@lyx.org>
Sat, 22 Feb 2014 15:30:55 +0000 (10:30 -0500)
src/mathed/InsetMathPhantom.cpp
src/mathed/MathMacro.cpp

index bbc2234a1863b2fe59f442a40c59e6f4af5583cd..cd4ae451cfdcf7b594302ddd5c392b4171358441 100644 (file)
@@ -240,6 +240,8 @@ void InsetMathPhantom::draw(PainterInfo & pi, int x, int y) const
 void InsetMathPhantom::write(WriteStream & os) const
 {
        MathEnsurer ensurer(os);
+       if (os.fragile())
+               os << "\\protect";
        switch (kind_) {
        case phantom:
                os << "\\phantom{";
index fe6e9188b0bd8b188c5fe96f7f23d7da54fc12bf..2f0241b5ac50b5bf6cc07a8252a0a1f5641e4f8c 100644 (file)
@@ -707,8 +707,8 @@ void MathMacro::write(WriteStream & os) const
        // we should be ok to continue even if this fails.
        LATTEST(macro_);
 
-       // optional arguments make macros fragile
-       if (optionals_ > 0 && os.fragile())
+       // Always protect macros in a fragile environment
+       if (os.fragile())
                os << "\\protect";
        
        os << "\\" << name();