]> git.lyx.org Git - features.git/commitdiff
* add \protect in front of macro with optional arguments because they are fragile
authorStefan Schimanski <sts@lyx.org>
Fri, 21 Dec 2007 20:43:50 +0000 (20:43 +0000)
committerStefan Schimanski <sts@lyx.org>
Fri, 21 Dec 2007 20:43:50 +0000 (20:43 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22243 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/MathMacro.cpp

index 5e8b4784597d68820e241cb07d04483658c3e3f5..0d985a7f72074a5586db45dbf392bbbf0a96c7b3 100644 (file)
@@ -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;