diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2022-03-04 18:06:48 -0500 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2022-03-05 20:04:20 -0500 |
commit | 64de4756b12d97932779e29b7a3a2ca9d3e29722 (patch) | |
tree | 23424ffd89fc6598a01eaca43c99fb9b6fe55057 | |
parent | latex, linebreak br (diff) |
latex, use geometry package for page setting
-rw-r--r-- | org/out_latex.org | 423 | ||||
-rw-r--r-- | src/doc_reform/io_out/latex.d | 335 |
2 files changed, 459 insertions, 299 deletions
diff --git a/org/out_latex.org b/org/out_latex.org index e6049fa..6fd0a20 100644 --- a/org/out_latex.org +++ b/org/out_latex.org @@ -33,7 +33,7 @@ template outputLaTeX() { static auto rgx = RgxO(); mixin spineLanguageCodes; auto lang = Lang(); - <<output_latex_shared_paper_type>> + <<output_latex_shared_geometry_paper_dimensions>> <<output_latex_shared_special_characters_to_escape_object>> <<output_latex_shared_special_characters_to_escape_text>> <<output_latex_shared_fontface>> @@ -55,14 +55,8 @@ template outputLaTeX() { <<output_latex_head_bullets_and_indentation>> <<output_latex_head>> <<output_latex_head_papertype>> - <<output_latex_head_footer>> + <<output_latex_head_footer>> <<output_latex_head_tex_papermargins>> - <<output_latex_head_tex_papermargins_portrait>> -<<output_latex_head_tex_papermargins_portrait_set>> -<<output_latex_head_tex_papermargins_portrait_close>> - <<output_latex_head_tex_papermargins_landscape>> -<<output_latex_head_tex_papermargins_landscape_set>> -<<output_latex_head_tex_papermargins_landscape_close>> <<output_latex_head_tex_columns_multi>> <<output_latex_head_tex_columns_multi_portrait>> <<output_latex_head_tex_columns_multi_portrait_set>> @@ -70,10 +64,10 @@ template outputLaTeX() { <<output_latex_head_tex_columns_multi_landscape>> <<output_latex_head_tex_colorlinks>> <<output_latex_head_tex_colorlinks_mono>> -<<output_latex_head_tex_colorlinks_mono_set>> + <<output_latex_head_tex_colorlinks_mono_set>> <<output_latex_head_tex_colorlinks_mono_close>> <<output_latex_head_tex_colorlinks_color>> -<<output_latex_head_tex_colorlinks_color_set>> + <<output_latex_head_tex_colorlinks_color_set>> <<output_latex_head_tex_colorlinks_color_close>> <<output_latex_head_format_string_paper_set>> <<output_latex_head_format_string_paper_set_format_portrait>> @@ -198,37 +192,59 @@ import doc_reform.io_out; #+END_SRC ** shared -*** paper dimensions (struct) +*** paper dimensions (struct) geometry -#+NAME: output_latex_shared_paper_type +#+NAME: output_latex_shared_geometry_paper_dimensions #+BEGIN_SRC d auto paper() { + string mm(uint mmi) { + string _mm = format(q"┃%smm┃", mmi.to!string); + return _mm; + } 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 fontsize = "11pt"; - string name = "a4paper"; - uint img_px = 450; - bool is_portrait = true; + string papersize = "a4paper"; + string orient = "portrait"; + string fontsize = "11pt"; + const uint w = 170; + const uint h = 257; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + 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 fontsize = "11pt"; - string name = "a4paper"; - uint img_px = 300; - bool is_portrait = false; + string papersize = "a4paper"; + string orient = "landscape"; + string fontsize = "11pt"; + const uint w = 238; + const uint h = 160; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + uint img_px = 300; + bool is_portrait = false; } return H(); } @@ -239,27 +255,45 @@ auto paper() { 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 fontsize = "11pt"; - string name = "a5paper"; - uint img_px = 280; - bool is_portrait = true; + string papersize = "a5paper"; + string orient = "portrait"; + string fontsize = "11pt"; + const uint w = 112; + const uint h = 162; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + 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 fontsize = "11pt"; - string name = "a5paper"; - uint img_px = 190; - bool is_portrait = false; + string papersize = "a5paper"; + string orient = "landscape"; + string fontsize = "11pt"; + const uint w = 152; + const uint h = 100; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + uint img_px = 190; + bool is_portrait = false; } return H(); } @@ -270,27 +304,45 @@ auto paper() { 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 fontsize = "11pt"; - string name = "b4paper"; - uint img_px = 356; - bool is_portrait = true; + string papersize = "b4paper"; + string orient = "portrait"; + string fontsize = "11pt"; + const uint w = 140; + const uint h = 204; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + 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 fontsize = "11pt"; - string name = "b4paper"; - uint img_px = 260; - bool is_portrait = false; + string papersize = "b4paper"; + string orient = "landscape"; + string fontsize = "11pt"; + const uint w = 200; + const uint h = 130; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + uint img_px = 260; + bool is_portrait = false; } return H(); } @@ -301,27 +353,45 @@ auto paper() { 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 fontsize = "11pt"; - string name = "letterpaper"; - uint img_px = 468; - bool is_portrait = true; + string papersize = "letterpaper"; + string orient = "portrait"; + string fontsize = "11pt"; + const uint w = 166; + const uint h = 212; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + 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 fontsize = "11pt"; - string name = "letterpaper"; - uint img_px = 290; - bool is_portrait = false; + string papersize = "letterpaper"; + string orient = "landscape"; + string fontsize = "11pt"; + const uint w = 226; + const uint h = 166; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + uint img_px = 290; + bool is_portrait = false; } return H(); } @@ -332,27 +402,45 @@ auto paper() { 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 fontsize = "11pt"; - string name = "legalpaper"; - uint img_px = 474; - bool is_portrait = true; + string papersize = "legalpaper"; + string orient = "portrait"; + string fontsize = "11pt"; + const uint w = 168; + const uint h = 286; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + 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 fontsize = "11pt"; - string name = "legalpaper"; - uint img_px = 420; - bool is_portrait = false; + string papersize = "legalpaper"; + string orient = "landscape"; + string fontsize = "11pt"; + const uint w = 296; + const uint h = 166; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + uint img_px = 420; + bool is_portrait = false; } return H(); } @@ -791,7 +879,6 @@ _txt = _txt \markboth{%s}{%s} \br\linebreak Copyright {\begin{small}{\copyright\end{small}} %s \br\linebreak %s -\pagestyle{fancy} \clearpage┃"; _txt = format(_tex_para, (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt, @@ -1152,34 +1239,34 @@ auto paper_type_latex = paperTypeLatex(); #+NAME: output_latex_head_footer #+BEGIN_SRC d - string _footer(M)(M doc_matters) { - string _ft = "\\lfoot[\\textrm{\\thepage}]"; - string _ft_1 = format(q"┃{\tiny \href{%s}{%s}}┃", "https://sisudoc.org", "SiSU",); - string _ft_2 = format(q"┃ +string _footer(M)(M doc_matters) { + string _ft = "\\lfoot[\\textrm{\\thepage}]"; + string _ft_1 = format(q"┃{\tiny \href{%s}{%s}}┃", "https://sisudoc.org", "SiSU",); + string _ft_2 = format(q"┃ \cfoot{\href{%s}{%s}}┃", "https://git.sisudoc.org", "git",); + if (doc_matters.conf_make_meta.make.footer.length > 0) { if (doc_matters.conf_make_meta.make.footer.length > 0) { - if (doc_matters.conf_make_meta.make.footer.length > 0) { - if (doc_matters.conf_make_meta.make.footer[0].matchAll(rgx.inline_link)) { - _ft ~= doc_matters.conf_make_meta.make.footer[0] - .replace(rgx.inline_link, "{\\tiny \\href{$2}{$1}}"); - } else { - _ft ~= _ft_1; - } + if (doc_matters.conf_make_meta.make.footer[0].matchAll(rgx.inline_link)) { + _ft ~= doc_matters.conf_make_meta.make.footer[0] + .replace(rgx.inline_link, "{\\tiny \\href{$2}{$1}}"); + } else { + _ft ~= _ft_1; } - if (doc_matters.conf_make_meta.make.footer.length > 1) { - if (doc_matters.conf_make_meta.make.footer[1].matchAll(rgx.inline_link)) { - _ft ~= doc_matters.conf_make_meta.make.footer[1] - .replace(rgx.inline_link, "\n\\cfoot{\\href{$2}{$1}}"); - } else { - _ft ~= _ft_2; - } + } + if (doc_matters.conf_make_meta.make.footer.length > 1) { + if (doc_matters.conf_make_meta.make.footer[1].matchAll(rgx.inline_link)) { + _ft ~= doc_matters.conf_make_meta.make.footer[1] + .replace(rgx.inline_link, "\n\\cfoot{\\href{$2}{$1}}"); + } else { + _ft ~= _ft_2; } - } else { - _ft ~= _ft_1; - _ft ~= _ft_2; } - return _ft; + } else { + _ft ~= _ft_1; + _ft ~= _ft_2; } + return _ft; +} #+END_SRC ***** paper margins @@ -1194,46 +1281,6 @@ struct paperMargins { auto margins = paperMargins(); #+END_SRC -****** portrait - -#+NAME: output_latex_head_tex_papermargins_portrait -#+BEGIN_SRC d -margins.portrait = format(q"┃ -#+END_SRC - -#+NAME: output_latex_head_tex_papermargins_portrait_set -#+BEGIN_SRC latex -\setlength{\oddsidemargin}{0mm} \setlength{\evensidemargin}{0mm} -\setlength{\topmargin}{-0.5pt} \setlength{\headheight}{14.5pt} -\setlength{\headsep}{35pt} -#+END_SRC - -#+NAME: output_latex_head_tex_papermargins_portrait_close -#+BEGIN_SRC d -┃", - ); -#+END_SRC - -****** landscape - -#+NAME: output_latex_head_tex_papermargins_landscape -#+BEGIN_SRC d -margins.landscape = format(q"┃ -#+END_SRC - -#+NAME: output_latex_head_tex_papermargins_landscape_set -#+BEGIN_SRC latex -\setlength{\oddsidemargin}{6mm} \setlength{\evensidemargin}{6mm} -\setlength{\topmargin}{-0.5pt} \setlength{\headheight}{14.5pt} -\setlength{\headsep}{20pt} -#+END_SRC - -#+NAME: output_latex_head_tex_papermargins_landscape_close -#+BEGIN_SRC d -┃", - ); -#+END_SRC - ***** multicol ****** struct @@ -1292,11 +1339,11 @@ links.mono = format(q"┃ #+NAME: output_latex_head_tex_colorlinks_mono_set #+BEGIN_SRC latex - colorlinks=true, - urlcolor=black, - filecolor=black, - linkcolor=black, - citecolor=black, +colorlinks=true, +urlcolor=black, +filecolor=black, +linkcolor=black, +citecolor=black, #+END_SRC #+NAME: output_latex_head_tex_colorlinks_mono_close @@ -1314,11 +1361,11 @@ links.color = format(q"┃ #+NAME: output_latex_head_tex_colorlinks_color_set #+BEGIN_SRC latex - colorlinks=true, - urlcolor=myblue, %% \href{...}{...} external url - filecolor=mygreen, %% \href{...} local file - linkcolor=myred, %% \href{...} and \pageref{...} - citecolor=black, +colorlinks=true, +urlcolor=myblue, %% \href{...}{...} external url +filecolor=mygreen, %% \href{...} local file +linkcolor=myred, %% \href{...} and \pageref{...} +citecolor=black, #+END_SRC #+NAME: output_latex_head_tex_colorlinks_color_close @@ -1346,17 +1393,27 @@ if (paper_set.is_portrait) { #+NAME: output_latex_head_format_string_paper_set_format_portrait_tex #+BEGIN_SRC d \documentclass[%s,%s,titlepage]{scrartcl} -\setlength{\textheight}{%s} \setlength{\textwidth}{%s} \usepackage{geometry} -┃", +\geometry{ + %s, + %s, + left=%s, + right=%s, + top=%s, + bottom=%s, +}┃", #+END_SRC #+NAME: output_latex_head_format_string_paper_set_format_portrait_variables #+BEGIN_SRC d paper_set.fontsize, - paper_set.name, - paper_set.height, - paper_set.width, + paper_set.papersize, + paper_set.papersize, + paper_set.orient, + paper_set.margin_left, + paper_set.margin_right, + paper_set.margin_top, + paper_set.margin_bottom, ); #+END_SRC @@ -1369,17 +1426,27 @@ if (paper_set.is_portrait) { #+NAME: output_latex_head_format_string_paper_set_format_landscape_tex #+BEGIN_SRC d \documentclass[%s,%s,landscape,titlepage,twocolumn]{scrartcl} -\setlength{\textheight}{%s} \setlength{\textwidth}{%s} \usepackage{geometry} -┃", +\geometry{ + %s, + %s, + left=%s, + right=%s, + top=%s, + bottom=%s, +}┃", #+END_SRC #+NAME: output_latex_head_format_string_paper_set_format_landscape_variables #+BEGIN_SRC d paper_set.fontsize, - paper_set.name, - paper_set.height, - paper_set.width, + paper_set.papersize, + paper_set.papersize, + paper_set.orient, + paper_set.margin_left, + paper_set.margin_right, + paper_set.margin_top, + paper_set.margin_bottom, ); #+END_SRC @@ -1491,13 +1558,10 @@ string _latex_head = format(q"┃%%%% spine LaTeX output #+NAME: output_latex_head_tex_set_usepackages_languages_and_font #+BEGIN_SRC latex \usepackage[T1]{fontenc} +%% \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{newunicodechar} \usepackage{polyglossia} -\usepackage{ucs} -\usepackage{fontspec} -\usepackage{xltxtra} -\usepackage{xunicode} \setmainlanguage{%s} \setotherlanguage{%s} \setmainfont{Liberation Sans} @@ -1512,7 +1576,6 @@ string _latex_head = format(q"┃%%%% spine LaTeX output #+NAME: output_latex_head_tex_set_usepackages_1 #+BEGIN_SRC latex \usepackage{alltt} -\usepackage{thumbpdf} \usepackage{hyperref} \hypersetup{ #+END_SRC diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d index 80904dd..c9d2213 100644 --- a/src/doc_reform/io_out/latex.d +++ b/src/doc_reform/io_out/latex.d @@ -63,32 +63,54 @@ template outputLaTeX() { mixin spineLanguageCodes; auto lang = Lang(); auto paper() { + string mm(uint mmi) { + string _mm = format(q"┃%smm┃", mmi.to!string); + return _mm; + } 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 fontsize = "11pt"; - string name = "a4paper"; - uint img_px = 450; - bool is_portrait = true; + string papersize = "a4paper"; + string orient = "portrait"; + string fontsize = "11pt"; + const uint w = 170; + const uint h = 257; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + 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 fontsize = "11pt"; - string name = "a4paper"; - uint img_px = 300; - bool is_portrait = false; + string papersize = "a4paper"; + string orient = "landscape"; + string fontsize = "11pt"; + const uint w = 238; + const uint h = 160; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + uint img_px = 300; + bool is_portrait = false; } return H(); } @@ -99,27 +121,45 @@ template outputLaTeX() { 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 fontsize = "11pt"; - string name = "a5paper"; - uint img_px = 280; - bool is_portrait = true; + string papersize = "a5paper"; + string orient = "portrait"; + string fontsize = "11pt"; + const uint w = 112; + const uint h = 162; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + 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 fontsize = "11pt"; - string name = "a5paper"; - uint img_px = 190; - bool is_portrait = false; + string papersize = "a5paper"; + string orient = "landscape"; + string fontsize = "11pt"; + const uint w = 152; + const uint h = 100; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + uint img_px = 190; + bool is_portrait = false; } return H(); } @@ -130,27 +170,45 @@ template outputLaTeX() { 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 fontsize = "11pt"; - string name = "b4paper"; - uint img_px = 356; - bool is_portrait = true; + string papersize = "b4paper"; + string orient = "portrait"; + string fontsize = "11pt"; + const uint w = 140; + const uint h = 204; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + 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 fontsize = "11pt"; - string name = "b4paper"; - uint img_px = 260; - bool is_portrait = false; + string papersize = "b4paper"; + string orient = "landscape"; + string fontsize = "11pt"; + const uint w = 200; + const uint h = 130; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + uint img_px = 260; + bool is_portrait = false; } return H(); } @@ -161,27 +219,45 @@ template outputLaTeX() { 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 fontsize = "11pt"; - string name = "letterpaper"; - uint img_px = 468; - bool is_portrait = true; + string papersize = "letterpaper"; + string orient = "portrait"; + string fontsize = "11pt"; + const uint w = 166; + const uint h = 212; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + 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 fontsize = "11pt"; - string name = "letterpaper"; - uint img_px = 290; - bool is_portrait = false; + string papersize = "letterpaper"; + string orient = "landscape"; + string fontsize = "11pt"; + const uint w = 226; + const uint h = 166; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + uint img_px = 290; + bool is_portrait = false; } return H(); } @@ -192,27 +268,45 @@ template outputLaTeX() { 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 fontsize = "11pt"; - string name = "legalpaper"; - uint img_px = 474; - bool is_portrait = true; + string papersize = "legalpaper"; + string orient = "portrait"; + string fontsize = "11pt"; + const uint w = 168; + const uint h = 286; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + 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 fontsize = "11pt"; - string name = "legalpaper"; - uint img_px = 420; - bool is_portrait = false; + string papersize = "legalpaper"; + string orient = "landscape"; + string fontsize = "11pt"; + const uint w = 296; + const uint h = 166; + const uint l = 30; + const uint r = 20; + const uint t = 30; + const uint b = 30; + string width = mm(w); + string height = mm(h); + string margin_left = mm(l); + string margin_right = mm(r); + string margin_top = mm(t); + string margin_bottom = mm(b); + uint img_px = 420; + bool is_portrait = false; } return H(); } @@ -517,7 +611,6 @@ template outputLaTeX() { \markboth{%s}{%s} \br\linebreak Copyright {\begin{small}{\copyright\end{small}} %s \br\linebreak %s -\pagestyle{fancy} \clearpage┃"; _txt = format(_tex_para, (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt, @@ -850,7 +943,7 @@ string table(O,M)( string _ft = "\\lfoot[\\textrm{\\thepage}]"; string _ft_1 = format(q"┃{\tiny \href{%s}{%s}}┃", "https://sisudoc.org", "SiSU",); string _ft_2 = format(q"┃ - \cfoot{\href{%s}{%s}}┃", "https://git.sisudoc.org", "git",); + \cfoot{\href{%s}{%s}}┃", "https://git.sisudoc.org", "git",); if (doc_matters.conf_make_meta.make.footer.length > 0) { if (doc_matters.conf_make_meta.make.footer.length > 0) { if (doc_matters.conf_make_meta.make.footer[0].matchAll(rgx.inline_link)) { @@ -879,18 +972,6 @@ string table(O,M)( string landscape; } auto margins = paperMargins(); - margins.portrait = format(q"┃ -\setlength{\oddsidemargin}{0mm} \setlength{\evensidemargin}{0mm} -\setlength{\topmargin}{-0.5pt} \setlength{\headheight}{14.5pt} -\setlength{\headsep}{35pt} -┃", - ); - margins.landscape = format(q"┃ -\setlength{\oddsidemargin}{6mm} \setlength{\evensidemargin}{6mm} -\setlength{\topmargin}{-0.5pt} \setlength{\headheight}{14.5pt} -\setlength{\headsep}{20pt} -┃", - ); struct columnsMulti { string portrait; string landscape; @@ -907,19 +988,19 @@ string table(O,M)( } auto links = colorLinks(); links.mono = format(q"┃ -colorlinks=true, -urlcolor=black, -filecolor=black, -linkcolor=black, -citecolor=black, + colorlinks=true, + urlcolor=black, + filecolor=black, + linkcolor=black, + citecolor=black, ┃", ); links.color = format(q"┃ -colorlinks=true, -urlcolor=myblue, %% \href{...}{...} external url -filecolor=mygreen, %% \href{...} local file -linkcolor=myred, %% \href{...} and \pageref{...} -citecolor=black, + colorlinks=true, + urlcolor=myblue, %% \href{...}{...} external url + filecolor=mygreen, %% \href{...} local file + linkcolor=myred, %% \href{...} and \pageref{...} + citecolor=black, ┃", ); string set_paper(P)(P paper_set,) { @@ -927,24 +1008,44 @@ citecolor=black, if (paper_set.is_portrait) { paper_type_description = format(q"┃ \documentclass[%s,%s,titlepage]{scrartcl} -\setlength{\textheight}{%s} \setlength{\textwidth}{%s} \usepackage{geometry} -┃", +\geometry{ + %s, + %s, + left=%s, + right=%s, + top=%s, + bottom=%s, +}┃", paper_set.fontsize, - paper_set.name, - paper_set.height, - paper_set.width, + paper_set.papersize, + paper_set.papersize, + paper_set.orient, + paper_set.margin_left, + paper_set.margin_right, + paper_set.margin_top, + paper_set.margin_bottom, ); } else { paper_type_description = format(q"┃ \documentclass[%s,%s,landscape,titlepage,twocolumn]{scrartcl} -\setlength{\textheight}{%s} \setlength{\textwidth}{%s} \usepackage{geometry} -┃", +\geometry{ + %s, + %s, + left=%s, + right=%s, + top=%s, + bottom=%s, +}┃", paper_set.fontsize, - paper_set.name, - paper_set.height, - paper_set.width, + paper_set.papersize, + paper_set.papersize, + paper_set.orient, + paper_set.margin_left, + paper_set.margin_right, + paper_set.margin_top, + paper_set.margin_bottom, ); } return paper_type_description; @@ -986,19 +1087,15 @@ citecolor=black, \setlength{\marginparwidth}{8mm} %s \usepackage[T1]{fontenc} +%% \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{newunicodechar} \usepackage{polyglossia} -\usepackage{ucs} -\usepackage{fontspec} -\usepackage{xltxtra} -\usepackage{xunicode} \setmainlanguage{%s} \setotherlanguage{%s} \setmainfont{Liberation Sans} \setmonofont[Scale=0.85]{Liberation Mono} \usepackage{alltt} -\usepackage{thumbpdf} \usepackage{hyperref} \hypersetup{ pdftitle={%s}, |