diff --git a/development/FORMAT b/development/FORMAT index ccd11c95e1..be58e39970 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -7,6 +7,10 @@ changes happened in particular if possible. A good example would be ----------------------- +2018-04-18 Jürgen Spitzmüller + * format incremented to 546: Add Landscape flex inset in Landscape module. + \begin{landscape}...\end{landscape} > \begin_inset Flex Landscape + 2018-03-14 Yuriy Skalko * Format incremented to 547: support for Charter font from XCharter package. diff --git a/lib/Makefile.am b/lib/Makefile.am index 5f55f0b692..f86b6de39a 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -2212,6 +2212,7 @@ dist_layouts_DATA =\ layouts/jss.layout \ layouts/kluwer.layout \ layouts/knitr.module \ + layouts/landscape.module \ layouts/latex8.layout \ layouts/letter.layout \ layouts/lettre.layout \ diff --git a/lib/layouts/landscape.module b/lib/layouts/landscape.module new file mode 100644 index 0000000000..15ca77be4c --- /dev/null +++ b/lib/layouts/landscape.module @@ -0,0 +1,23 @@ +#\DeclareLyXModule{Landscape} +#DescriptionBegin +#Output parts of the document in landscape mode. +#DescriptionEnd +# +#Author: Jürgen Spitzmüller + +Format 67 + +InsetLayout Flex:Landscape + LyXType custom + Decoration classic + ResetsFont 0 + MultiPar 1 + LabelString Landscape + LatexName landscape + LatexType environment + LabelFont + Family Roman + Color red + EndFont + Requires lscape +End diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py index 7aae4097fe..17821ec80b 100644 --- a/lib/lyx2lyx/lyx_2_4.py +++ b/lib/lyx2lyx/lyx_2_4.py @@ -24,16 +24,16 @@ import sys, os # Uncomment only what you need to import, please. -from parser_tools import (find_end_of_inset, find_token, get_bool_value, get_value) +from parser_tools import (find_end_of_inset, find_end_of_layout, find_token, get_bool_value, get_value) # del_token, del_value, del_complete_lines, -# find_complete_lines, find_end_of, find_end_of_layout, +# find_complete_lines, find_end_of, # find_re, find_substring, find_token_backwards, # get_containing_inset, get_containing_layout, get_value, # get_quoted_value, is_in_inset, set_bool_value # find_tokens, find_token_exact, check_token, get_option_value -from lyx2lyx_tools import (add_to_preamble) -# put_cmd_in_ert, revert_font_attrs, insert_to_preamble, latex_length +from lyx2lyx_tools import (put_cmd_in_ert, add_to_preamble) +# revert_font_attrs, insert_to_preamble, latex_length # get_ert, lyx2latex, lyx2verbatim, length_in_bp, convert_info_insets # revert_flex_inset, hex2ratio, str2bool @@ -153,6 +153,29 @@ def revert_xcharter(document): add_to_preamble(document, ["\\usepackage%s{XCharter}"%options]) +def revert_lscape(document): + " Reverts the landscape environment (Landscape module) to TeX-code " + + if not "landscape" in document.get_module_list(): + return + + i = 0 + while True: + i = find_token(document.body, "\\begin_inset Flex Landscape", i) + if i == -1: + return + j = find_end_of_inset(document.body, i) + if j == -1: + document.warning("Malformed LyX document: Can't find end of Landscape inset") + 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}") + add_to_preamble(document, ["\\usepackage{pdflscape}"]) + # no need to reset i + + ## # Conversion hub # @@ -161,10 +184,12 @@ supported_versions = ["2.4.0", "2.4"] convert = [ [545, [convert_lst_literalparam]], [546, []], - [547, []] + [547, []], + [548, []] ] revert = [ + [547, [revert_lscape]], [546, [revert_xcharter]], [545, [revert_paratype]], [544, [revert_lst_literalparam]] diff --git a/src/tex2lyx/TODO.txt b/src/tex2lyx/TODO.txt index be5d770021..b108eb2822 100644 --- a/src/tex2lyx/TODO.txt +++ b/src/tex2lyx/TODO.txt @@ -58,6 +58,9 @@ Format LaTeX feature LyX feature \begin{btUnit}...\end{btUnit} \multibib {none|part|chapter|section|subsection} (if a part, chapter, section etc. follows the \begin...) +546 Landscape support + \begin{landscape}...\end{landscape} \begin_inset Flex Landscape + with longtable content: diff --git a/src/version.h b/src/version.h index 8d136cdff4..4b5639f3b2 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 547 // Yuriy Skalko: support for XCharter font -#define LYX_FORMAT_TEX2LYX 547 +#define LYX_FORMAT_LYX 548 // spitz: landscape module +#define LYX_FORMAT_TEX2LYX 548 #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX #ifndef _MSC_VER