From 97e1806c4aaf643aeb0c4cb018c703c7d9a1aa44 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Wed, 18 Apr 2018 16:20:19 +0200 Subject: [PATCH] Add a floating landscape inset --- lib/chkconfig.ltx | 1 + lib/doc/LaTeXConfig.lyx | 33 +++++++++++++++++++++++++++++++++ lib/layouts/landscape.module | 9 +++++++++ lib/lyx2lyx/lyx_2_4.py | 10 ++++++++-- src/LaTeXFeatures.cpp | 1 + 5 files changed, 52 insertions(+), 2 deletions(-) diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx index 7dc6812030..95a72ff7df 100644 --- a/lib/chkconfig.ltx +++ b/lib/chkconfig.ltx @@ -271,6 +271,7 @@ \TestPackage{a0poster} \TestPackage{accents} \TestPackage{achicago} +\TestPackage{afterpage} \TestPackage{algorithm} \TestPackage{algorithm2e} \TestPackage{amsmath} diff --git a/lib/doc/LaTeXConfig.lyx b/lib/doc/LaTeXConfig.lyx index 9b95b3b259..6bbbe2b077 100644 --- a/lib/doc/LaTeXConfig.lyx +++ b/lib/doc/LaTeXConfig.lyx @@ -6280,6 +6280,39 @@ literal "false" . \end_layout +\begin_layout Subsection +Landscape module +\end_layout + +\begin_layout Subsubsection +afterpage +\end_layout + +\begin_layout Description +Found: +\begin_inset Info +type "package" +arg "afterpage" +\end_inset + + +\end_layout + +\begin_layout Description +CTAN: +\family typewriter +macros/latex/required/tools/ +\end_layout + +\begin_layout Description +Notes: The package +\family sans +afterpage +\family default + provides a command to shift content after the next page break (used for + gloating landscape). +\end_layout + \begin_layout Subsection Linguistics module \end_layout diff --git a/lib/layouts/landscape.module b/lib/layouts/landscape.module index 15ca77be4c..c6f081ba6e 100644 --- a/lib/layouts/landscape.module +++ b/lib/layouts/landscape.module @@ -21,3 +21,12 @@ InsetLayout Flex:Landscape EndFont Requires lscape End + +InsetLayout Flex:Landscape_(Floating) + CopyStyle Flex:Landscape + LatexType none + LabelString "Landscape (floating)" + LeftDelim \afterpage{\begin{landscape}
+ RightDelim
\end{landscape}} + Requires lscape,afterpage +End diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py index 17821ec80b..c4b023b605 100644 --- a/lib/lyx2lyx/lyx_2_4.py +++ b/lib/lyx2lyx/lyx_2_4.py @@ -170,8 +170,14 @@ def revert_lscape(document): i += 1 continue - document.body[j - 2 : j + 1] = put_cmd_in_ert("\\end{landscape}") - document.body[i : i + 4] = put_cmd_in_ert("\\begin{landscape}") + if document.body[i] == "\\begin_inset Flex Landscape (Floating)": + document.body[j - 2 : j + 1] = put_cmd_in_ert("\\end{landscape}}") + document.body[i : i + 4] = put_cmd_in_ert("\\afterpage{\\begin{landscape}") + add_to_preamble(document, ["\\usepackage{afterpage}"]) + else: + document.body[j - 2 : j + 1] = put_cmd_in_ert("\\end{landscape}") + document.body[i : i + 4] = put_cmd_in_ert("\\begin{landscape}") + add_to_preamble(document, ["\\usepackage{pdflscape}"]) # no need to reset i diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index 0f91e89107..dddfc2e666 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -971,6 +971,7 @@ char const * simplefeatures[] = { "varwidth", "footnote", "tablefootnote", + "afterpage", }; char const * bibliofeatures[] = {