]> git.lyx.org Git - features.git/commitdiff
\\pagebreak is a fragile command in general
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 22 Apr 2016 12:57:12 +0000 (14:57 +0200)
committerRichard Heck <rgheck@lyx.org>
Wed, 15 Jun 2016 21:32:53 +0000 (22:32 +0100)
As such, it shall be protected in moving arguments, such as sections.

Fixes bug #10092.
(cherry picked from commit 86ee2699c30b63e5b4de3ad725519756d17aec2c)

src/insets/InsetNewpage.cpp
status.22x

index 5e98428fcdcd7dfd060adacbc189325229719fd5..418bf8b3614e6f4b6d61fe486c1bed9df3efec68 100644 (file)
@@ -212,13 +212,15 @@ ColorCode InsetNewpage::ColorName() const
 }
 
 
-void InsetNewpage::latex(otexstream & os, OutputParams const &) const
+void InsetNewpage::latex(otexstream & os, OutputParams const & runparams) const
 {
        switch (params_.kind) {
                case InsetNewpageParams::NEWPAGE:
                        os << "\\newpage{}";
                        break;
                case InsetNewpageParams::PAGEBREAK:
+                       if (runparams.moving_arg)
+                               os << "\\protect";
                        os << "\\pagebreak{}";
                        break;
                case InsetNewpageParams::CLEARPAGE:
index fd43f4ecc84c34974779394c9fd7e1f370441d41..23c7143bdf2a58dd23c5d25d5b0384ce4081c6c2 100644 (file)
@@ -58,6 +58,8 @@ What's new
 - InPreamble styles should be written to the premable as many times as the
   user requests them, even if it results in duplicate commands.
 
+- Correctly protect the \pagebreak command when needed (bug 10092).
+
 
 * LYX2LYX