commit 64be8c6553e053521a4e8a32636b2e7474181b33
Author: Enrico Forestieri <[email protected]>
Date: Sat Feb 22 10:30:55 2014 -0500
Fix bug #8889 by always issuing \protect in fragile environments.
(cherry picked from commit 3c1969574f2a8ceeb035146d79e482289d9e80ec)
diff --git a/src/mathed/InsetMathPhantom.cpp b/src/mathed/InsetMathPhantom.cpp
index d6cd1b2..cc8f6ee 100644
--- a/src/mathed/InsetMathPhantom.cpp
+++ b/src/mathed/InsetMathPhantom.cpp
@@ -120,6 +120,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{";
diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp
index cd9b757..7dc7f55 100644
--- a/src/mathed/MathMacro.cpp
+++ b/src/mathed/MathMacro.cpp
@@ -704,8 +704,8 @@ void MathMacro::write(WriteStream & os) const
// normal mode
LASSERT(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();
diff --git a/status.20x b/status.20x
index c65ca55..21bf4da 100644
--- a/status.20x
+++ b/status.20x
@@ -65,6 +65,8 @@ What's new
- Fix bug where depth of pasted text was incorrectly set (bug 8891).
+- Fix clash between \protect and \ensuremath (bug 8889).
+
* USER INTERFACE