aboutsummaryrefslogtreecommitdiffhomepage
path: root/org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2022-03-04 18:06:48 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2022-03-05 20:04:20 -0500
commit64de4756b12d97932779e29b7a3a2ca9d3e29722 (patch)
tree23424ffd89fc6598a01eaca43c99fb9b6fe55057 /org
parentlatex, linebreak br (diff)
latex, use geometry package for page setting
Diffstat (limited to 'org')
-rw-r--r--org/out_latex.org423
1 files changed, 243 insertions, 180 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