diff options
Diffstat (limited to 'org/out_latex.org')
-rw-r--r-- | org/out_latex.org | 66 |
1 files changed, 62 insertions, 4 deletions
diff --git a/org/out_latex.org b/org/out_latex.org index 97fe425..0b37389 100644 --- a/org/out_latex.org +++ b/org/out_latex.org @@ -773,8 +773,60 @@ _txt = _txt string _txt, O obj, M doc_matters, + string paper_size_orientation, string _part = "" ) { + string manual_breaks( + string test_for_break_level, + string _pg_break + ) { + if ((!(doc_matters.conf_make_meta.make.breaks.empty) + && (matchFirst(doc_matters.conf_make_meta.make.breaks, test_for_break_level))) + ) { // manually override defaults + if ((matchFirst(doc_matters.conf_make_meta.make.breaks, rgx.make_breakpage)) + && (matchFirst(doc_matters.conf_make_meta.make.breaks, rgx.make_breakcolumn)) + ) { + if (auto m = matchFirst(doc_matters.conf_make_meta.make.breaks, rgx.make_breakpage)) { + if (matchFirst(m.captures["breakpage"], test_for_break_level)) { + _pg_break = "\\clearpage\n"; + } else if (auto n = matchFirst(doc_matters.conf_make_meta.make.breaks, rgx.make_breakcolumn)) { + if (matchFirst(n.captures["breakcolumn"], test_for_break_level)) { + if ((paper_size_orientation == "a4.landscape") + || (paper_size_orientation == "b4.landscape") + || (paper_size_orientation == "a5.landscape") + || (paper_size_orientation == "letter.landscape") + || (paper_size_orientation == "legal.landscape") + ) { + _pg_break = "\\\\ \\columnbreak\n"; // "\\\\ \\newpage\n"; + } else { // portrait + _pg_break = "\\clearpage\n"; + } + } + } + } + } else if (auto m = matchFirst(doc_matters.conf_make_meta.make.breaks, rgx.make_breakpage)) { + if (matchFirst(m.captures["breakpage"], test_for_break_level)) { + _pg_break = "\\clearpage\n"; + } + } else if (auto m = matchFirst(doc_matters.conf_make_meta.make.breaks, rgx.make_breakcolumn)) { + if (matchFirst(m.captures["breakcolumn"], test_for_break_level)) { + if ((paper_size_orientation == "a4.landscape") + || (paper_size_orientation == "b4.landscape") + || (paper_size_orientation == "a5.landscape") + || (paper_size_orientation == "letter.landscape") + || (paper_size_orientation == "legal.landscape") + ) { + _pg_break = "\\\\ \\columnbreak\n"; // "\\\\ \\newpage\n"; + } else { // portrait + _pg_break = "\\clearpage\n"; + } + } + } + } else if (!(doc_matters.conf_make_meta.make.breaks.empty)) { + _pg_break = ""; + } + return _pg_break; + } if (obj.metainfo.is_a == "heading") { string _tex_para; string _pg_break; @@ -798,7 +850,13 @@ _txt = _txt case 4: // 1 == section _columns = (_part != "bookindex") ? "" : "\n\\br\n\\begin{multicols}{2}"; - _pg_break = "\\clearpage\n"; + if (doc_matters.conf_make_meta.make.doc_type == "article") { // defaults for article + _pg_break = ""; + } else if (doc_matters.conf_make_meta.make.doc_type == "book") { // defaults for book + _pg_break = "\\clearpage\n"; + } else { + _pg_break = "\\clearpage\n"; + } _sect = "section"; _post = ""; _title_add = format(q"┃ @@ -1848,7 +1906,7 @@ case "frontmatter": assert(part == "head" || "toc"); case "para": switch (obj.metainfo.is_a) { case "heading": - _txt = _txt.heading(obj, doc_matters); + _txt = _txt.heading(obj, doc_matters, paper_size_orientation); goto default; case "toc": break; @@ -1875,7 +1933,7 @@ case "body": assert(part == "body" || "head"); // surprise case "para": switch (obj.metainfo.is_a) { case "heading": - _txt = _txt.heading(obj, doc_matters); + _txt = _txt.heading(obj, doc_matters, paper_size_orientation); goto default; case "para": _txt = _txt.para(obj) @@ -1945,7 +2003,7 @@ case "backmatter": if (part == "bookindex") { _multicolumns = true; } - _txt = _txt.heading(obj, doc_matters, part); + _txt = _txt.heading(obj, doc_matters, paper_size_orientation, part); goto default; case "endnote": assert(part == "endnotes"); /* uncomment code to reinstate endnotes in endnote section */ |