From 02718313824caa0e87eb0f1448684ff8d2dbe4d1 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 5 Oct 2021 12:39:53 -0400 Subject: primarily org related --- src/doc_reform/io_out/latex.d | 396 +++++++++++++++++++++--------------------- 1 file changed, 198 insertions(+), 198 deletions(-) (limited to 'src/doc_reform/io_out/latex.d') diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d index 811f32e..117b3e7 100644 --- a/src/doc_reform/io_out/latex.d +++ b/src/doc_reform/io_out/latex.d @@ -40,7 +40,7 @@ - docReform object numbering - standard SiSU object citation numbering & system - - Hompages: + - Homepages: [https://www.doc_reform.org] [https://www.sisudoc.org] @@ -62,166 +62,166 @@ template outputLaTeX() { static auto rgx = RgxO(); mixin spineLanguageCodes; auto lang = Lang(); - auto paper() { - struct PaperType { - @safe auto a4() { - struct A4 { - auto portrait() { - struct V { - const uint w = 160; - const uint h = 228; - string width = format(q"┃%dmm┃", w); - string height = format(q"┃%dmm┃", h); - string font_size = "12pt"; - string name = "a4paper"; - uint img_px = 450; - bool is_portrait = true; - } - return V(); - } - auto landscape() { - struct H { - const uint w = 238; - const uint h = 160; - string width = format(q"┃%dmm┃", w); - string height = format(q"┃%dmm┃", h); - string font_size = "11pt"; - string name = "a4paper"; - uint img_px = 300; - bool is_portrait = false; - } - return H(); - } + auto paper() { + struct PaperType { + @safe auto a4() { + struct A4 { + auto portrait() { + struct V { + const uint w = 160; + const uint h = 228; + string width = format(q"┃%dmm┃", w); + string height = format(q"┃%dmm┃", h); + string font_size = "12pt"; + string name = "a4paper"; + uint img_px = 450; + bool is_portrait = true; } - return A4(); + return V(); } - @safe auto a5() { - struct A5 { - auto portrait() { - struct V { - const uint w = 112; - const uint h = 162; - string width = format(q"┃%dmm┃", w); - string height = format(q"┃%dmm┃", h); - string font_size = "0pt"; - string name = "a5paper"; - uint img_px = 280; - bool is_portrait = true; - } - return V(); - } - auto landscape() { - struct H { - const uint w = 152; - const uint h = 100; - string width = format(q"┃%dmm┃", w); - string height = format(q"┃%dmm┃", h); - string font_size = "0pt"; - string name = "a5paper"; - uint img_px = 190; - bool is_portrait = false; - } - return H(); - } + auto landscape() { + struct H { + const uint w = 238; + const uint h = 160; + string width = format(q"┃%dmm┃", w); + string height = format(q"┃%dmm┃", h); + string font_size = "11pt"; + string name = "a4paper"; + uint img_px = 300; + bool is_portrait = false; } - return A5(); + return H(); } - @safe auto b4() { - struct B4 { - auto portrait() { - struct V { - const uint w = 140; - const uint h = 204; - string width = format(q"┃%dmm┃", w); - string height = format(q"┃%dmm┃", h); - string font_size = "0pt"; - string name = "b4paper"; - uint img_px = 356; - bool is_portrait = true; - } - return V(); - } - auto landscape() { - struct H { - const uint w = 200; - const uint h = 130; - string width = format(q"┃%dmm┃", w); - string height = format(q"┃%dmm┃", h); - string font_size = "0pt"; - string name = "b4paper"; - uint img_px = 260; - bool is_portrait = false; - } - return H(); - } + } + return A4(); + } + @safe auto a5() { + struct A5 { + auto portrait() { + struct V { + const uint w = 112; + const uint h = 162; + string width = format(q"┃%dmm┃", w); + string height = format(q"┃%dmm┃", h); + string font_size = "0pt"; + string name = "a5paper"; + uint img_px = 280; + bool is_portrait = true; } - return B4(); + return V(); } - @safe auto letter() { - struct Letter { - auto portrait() { - struct V { - const uint w = 166; - const uint h = 212; - string width = format(q"┃%dmm┃", w); - string height = format(q"┃%dmm┃", h); - string font_size = "0pt"; - string name = "letterpaper"; - uint img_px = 468; - bool is_portrait = true; - } - return V(); - } - auto landscape() { - struct H { - const uint w = 226; - const uint h = 166; - string width = format(q"┃%dmm┃", w); - string height = format(q"┃%dmm┃", h); - string font_size = "0pt"; - string name = "letterpaper"; - uint img_px = 290; - bool is_portrait = false; - } - return H(); - } + auto landscape() { + struct H { + const uint w = 152; + const uint h = 100; + string width = format(q"┃%dmm┃", w); + string height = format(q"┃%dmm┃", h); + string font_size = "0pt"; + string name = "a5paper"; + uint img_px = 190; + bool is_portrait = false; } - return Letter(); + return H(); } - @safe auto legal() { - struct Legal { - auto portrait() { - struct V { - const uint w = 168; - const uint h = 286; - string width = format(q"┃%dmm┃", w); - string height = format(q"┃%dmm┃", h); - string font_size = "0pt"; - string name = "legalpaper"; - uint img_px = 474; - bool is_portrait = true; - } - return V(); - } - auto landscape() { - struct H { - const uint w = 296; - const uint h = 166; - string width = format(q"┃%dmm┃", w); - string height = format(q"┃%dmm┃", h); - string font_size = "0pt"; - string name = "legalpaper"; - uint img_px = 420; - bool is_portrait = false; - } - return H(); - } + } + return A5(); + } + @safe auto b4() { + struct B4 { + auto portrait() { + struct V { + const uint w = 140; + const uint h = 204; + string width = format(q"┃%dmm┃", w); + string height = format(q"┃%dmm┃", h); + string font_size = "0pt"; + string name = "b4paper"; + uint img_px = 356; + bool is_portrait = true; + } + return V(); + } + auto landscape() { + struct H { + const uint w = 200; + const uint h = 130; + string width = format(q"┃%dmm┃", w); + string height = format(q"┃%dmm┃", h); + string font_size = "0pt"; + string name = "b4paper"; + uint img_px = 260; + bool is_portrait = false; + } + return H(); + } + } + return B4(); + } + @safe auto letter() { + struct Letter { + auto portrait() { + struct V { + const uint w = 166; + const uint h = 212; + string width = format(q"┃%dmm┃", w); + string height = format(q"┃%dmm┃", h); + string font_size = "0pt"; + string name = "letterpaper"; + uint img_px = 468; + bool is_portrait = true; + } + return V(); + } + auto landscape() { + struct H { + const uint w = 226; + const uint h = 166; + string width = format(q"┃%dmm┃", w); + string height = format(q"┃%dmm┃", h); + string font_size = "0pt"; + string name = "letterpaper"; + uint img_px = 290; + bool is_portrait = false; } - return Legal(); + return H(); } } - return PaperType(); + return Letter(); } + @safe auto legal() { + struct Legal { + auto portrait() { + struct V { + const uint w = 168; + const uint h = 286; + string width = format(q"┃%dmm┃", w); + string height = format(q"┃%dmm┃", h); + string font_size = "0pt"; + string name = "legalpaper"; + uint img_px = 474; + bool is_portrait = true; + } + return V(); + } + auto landscape() { + struct H { + const uint w = 296; + const uint h = 166; + string width = format(q"┃%dmm┃", w); + string height = format(q"┃%dmm┃", h); + string font_size = "0pt"; + string name = "legalpaper"; + uint img_px = 420; + bool is_portrait = false; + } + return H(); + } + } + return Legal(); + } + } + return PaperType(); + } @safe string sp_char_esc(O)( string _txt, const O obj, @@ -789,19 +789,19 @@ string table(O,M)( M doc_matters, string paper_size_orientation, ) { - struct paperTypeLatex { - string a4_portrait; - string a4_landscape; - string a5_portrait; - string a5_landscape; - string b4_portrait; - string b4_landscape; - string us_letter_portrait; - string us_letter_landscape; - string us_legal_portrait; - string us_legal_landscape; - } - auto paper_type_latex = paperTypeLatex(); + struct paperTypeLatex { + string a4_portrait; + string a4_landscape; + string a5_portrait; + string a5_landscape; + string b4_portrait; + string b4_landscape; + string us_letter_portrait; + string us_letter_landscape; + string us_legal_portrait; + string us_legal_landscape; + } + auto paper_type_latex = paperTypeLatex(); string _footer(M)(M doc_matters) { string _ft = "\\lfoot[\\textrm{\\thepage}]"; string _ft_1 = format(q"┃{\tiny \href{%s}{%s}}┃", "https://sisudoc.org", "SiSU",); @@ -830,39 +830,39 @@ string table(O,M)( } return _ft; } - struct paperMargins { - string portrait; - string landscape; - } - auto margins = paperMargins(); - margins.portrait = format(q"┃ +struct paperMargins { + string portrait; + string landscape; +} +auto margins = paperMargins(); +margins.portrait = format(q"┃ \setlength{\oddsidemargin}{0mm} \setlength{\evensidemargin}{0mm} \setlength{\topmargin}{-12pt} \setlength{\headheight}{12pt} \setlength{\headsep}{35pt} ┃", ); - margins.landscape = format(q"┃ +margins.landscape = format(q"┃ \setlength{\oddsidemargin}{6mm} \setlength{\evensidemargin}{6mm} \setlength{\topmargin}{-12mm} \setlength{\headheight}{12pt} \setlength{\headsep}{20pt} ┃", ); - struct columnsMulti { - string portrait; - string landscape; - } - auto multicol = columnsMulti(); - multicol.portrait = format(q"┃ +struct columnsMulti { + string portrait; + string landscape; +} +auto multicol = columnsMulti(); +multicol.portrait = format(q"┃ \usepackage{multicol} ┃", ); - multicol.landscape = ""; - struct colorLinks { - string mono; - string color; - } - auto links = colorLinks(); - links.mono = format(q"┃ +multicol.landscape = ""; +struct colorLinks { + string mono; + string color; +} +auto links = colorLinks(); +links.mono = format(q"┃ \usepackage[xetex, colorlinks=true, urlcolor=myblack, @@ -870,7 +870,7 @@ string table(O,M)( linkcolor=myblack, ┃", ); - links.color = format(q"┃ +links.color = format(q"┃ \usepackage[xetex, colorlinks=true, urlcolor=myblue, %% \href{...}{...} external url @@ -1271,25 +1271,25 @@ string table(O,M)( default: break; } break; - case "comment": - break; - default: - { /+ debug +/ - if (doc_matters.opt.action.debug_do - && doc_matters.opt.action.verbose) { - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); - writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); - writeln(__FILE__, ":", __LINE__, ": ", obj.text); - } + case "comment": + break; + default: + { /+ debug +/ + if (doc_matters.opt.action.debug_do + && doc_matters.opt.action.verbose) { + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); + writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); + writeln(__FILE__, ":", __LINE__, ": ", obj.text); } - break; } + break; } } - if (_multicolumns) { - _multicolumns = false; - _latex_body ~= "\n\\end{multicols}\n"; - } + } + if (_multicolumns) { + _multicolumns = false; + _latex_body ~= "\n\\end{multicols}\n"; + } return _latex_body; } string latex_tail(M)( -- cgit v1.2.3