From 992ae20115c7cffc8a7de0995e1e32536e13a09a Mon Sep 17 00:00:00 2001 From: Stefan Schimanski Date: Fri, 21 Dec 2007 20:43:50 +0000 Subject: [PATCH] * add \protect in front of macro with optional arguments because they are fragile git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22243 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/MathMacro.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp index 5e8b478459..0d985a7f72 100644 --- a/src/mathed/MathMacro.cpp +++ b/src/mathed/MathMacro.cpp @@ -553,6 +553,10 @@ void MathMacro::write(WriteStream & os) const // normal mode BOOST_ASSERT(macro_); + // optional arguments make macros fragile + if (optionals_ > 0 && os.fragile()) + os << "\\protect"; + os << "\\" << name(); bool first = true; idx_type i = 0; -- 2.39.5