From b42c5dd7d6064021cb99c44a71d320ee1878210a Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Thu, 28 Jan 2021 10:24:28 +0100 Subject: [PATCH] Add frontispiece layout to KOMA classes --- development/FORMAT | 3 +++ lib/layouts/scrclass.inc | 5 +++++ lib/lyx2lyx/lyx_2_4.py | 33 +++++++++++++++++++++++++++++++-- src/version.h | 4 ++-- 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index d0e9cb5ae5..50ddc45e16 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -7,6 +7,9 @@ changes happened in particular if possible. A good example would be ----------------------- +2021-01-28 Jürgen Spitzmüller + * Format incremented to 606: Support KOMA \frontispiece. + 2021-01-22 Jürgen Spitzmüller * Format incremented to 605: Extended variable table cell support. - Multicolumn now supports multiple paragraphs in non-fixed-width context. diff --git a/lib/layouts/scrclass.inc b/lib/layouts/scrclass.inc index c114fdd72f..4d20ca8fd7 100644 --- a/lib/layouts/scrclass.inc +++ b/lib/layouts/scrclass.inc @@ -286,6 +286,11 @@ Style Extratitle LatexName extratitle End +Style Frontispiece + CopyStyle Titlehead + LatexName frontispiece +End + Input stdstruct.inc Style Abstract diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py index f1c06ca39c..2ea050e6ee 100644 --- a/lib/lyx2lyx/lyx_2_4.py +++ b/lib/lyx2lyx/lyx_2_4.py @@ -4369,6 +4369,33 @@ def convert_vcolumns2(document): r'\usepackage{varwidth}']) +frontispiece_def = [ + r'### Inserted by lyx2lyx (frontispiece layout) ###', + r'Style Frontispiece', + r' CopyStyle Titlehead', + r' LatexName frontispiece', + r'End', +] + + +def convert_koma_frontispiece(document): + """Remove local KOMA frontispiece definition""" + if document.textclass[:3] != "scr": + return + + if document.del_local_layout(frontispiece_def): + document.add_module("ruby") + + +def revert_koma_frontispiece(document): + """Add local KOMA frontispiece definition""" + if document.textclass[:3] != "scr": + return + + if find_token(document.body, "\\begin_layout Frontispiece", 0) != -1: + document.append_local_layout(frontispiece_def) + + ## # Conversion hub # @@ -4435,10 +4462,12 @@ convert = [ [602, [convert_branch_colors]], [603, []], [604, []], - [605, [convert_vcolumns2]] + [605, [convert_vcolumns2]], + [606, [convert_koma_frontispiece]] ] -revert = [[604, [revert_vcolumns2]], +revert = [[605, [revert_koma_frontispiece]], + [604, [revert_vcolumns2]], [603, [revert_branch_darkcols]], [602, [revert_darkmode_graphics]], [601, [revert_branch_colors]], diff --git a/src/version.h b/src/version.h index 8fe59c1c04..c8c3c49baf 100644 --- a/src/version.h +++ b/src/version.h @@ -32,8 +32,8 @@ extern char const * const lyx_version_info; // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -#define LYX_FORMAT_LYX 605 // spitz: improved varwidth cells -#define LYX_FORMAT_TEX2LYX 605 +#define LYX_FORMAT_LYX 606 // spitz: frontispiece KOMA layout +#define LYX_FORMAT_TEX2LYX 606 #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX #ifndef _MSC_VER