From b6552d017b9c5ae40a30c5f2de3fe2f44a88f0fb Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 22 Apr 2016 14:57:12 +0200 Subject: [PATCH] \\pagebreak is a fragile command in general As such, it shall be protected in moving arguments, such as sections. Fixes bug #10092. (cherry picked from commit 86ee2699c30b63e5b4de3ad725519756d17aec2c) --- src/insets/InsetNewpage.cpp | 4 +++- status.22x | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/insets/InsetNewpage.cpp b/src/insets/InsetNewpage.cpp index 5e98428fcd..418bf8b361 100644 --- a/src/insets/InsetNewpage.cpp +++ b/src/insets/InsetNewpage.cpp @@ -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: diff --git a/status.22x b/status.22x index fd43f4ecc8..23c7143bdf 100644 --- a/status.22x +++ b/status.22x @@ -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 -- 2.39.5