aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/io_out
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc_reform/io_out')
-rw-r--r--src/doc_reform/io_out/latex.d335
1 files changed, 216 insertions, 119 deletions
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},