Fix bug #8889 by always issuing \protect in fragile environments.

This commit is contained in:
Enrico Forestieri 2014-02-22 10:30:55 -05:00 committed by Richard Heck
parent 270201ed67
commit 3c1969574f
2 changed files with 4 additions and 2 deletions

View 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{";

View 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();