aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/io_out/latex.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2022-04-02 10:37:34 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2022-04-03 18:13:53 -0400
commit4b0ae05439e2f5c33c452bd39baed3b8198ccc4a (patch)
tree85c4bc117bdfd3ff1aa967c8a1d4f337db647444 /src/doc_reform/io_out/latex.d
parentlatex header, work on (& some code formatting) (diff)
latex head adjustments
Diffstat (limited to 'src/doc_reform/io_out/latex.d')
-rw-r--r--src/doc_reform/io_out/latex.d60
1 files changed, 26 insertions, 34 deletions
diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d
index 1f58c35..fb7e2d8 100644
--- a/src/doc_reform/io_out/latex.d
+++ b/src/doc_reform/io_out/latex.d
@@ -316,9 +316,8 @@ template outputLaTeX() {
}
return PaperType();
}
- @safe string sp_char_esc(O)(
+ @safe string sp_char_ops()(
string _txt,
- const O obj,
) {
string _unescape_sp_char_esc()(string _txt) {
_txt = _txt
@@ -333,34 +332,27 @@ template outputLaTeX() {
format(q"┃%s%s┃", "$1", "$2"));
return _txt;
}
+ _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx.latex_special_char_for_escape);
+ _txt = replaceAll!(m => "{\\" ~ m[1] ~ "}")(_txt, rgx.latex_special_char_for_escape_and_braces);
+ _txt = replaceAll!(m => "''")(_txt, rgx.quotes_open_and_close);
+ _txt = replaceAll!(m => "$\\cdot$")(_txt, rgx.middle_dot);
+ _txt = replaceAll!(m => _unescape_sp_char_esc(m[0]))(_txt, rgx.latex_identify_inline_link);
+ _txt = replaceAll!(m => _unescape_fontface_esc(m[0]))(_txt, rgx.latex_identify_inline_fontface);
+ return _txt;
+ }
+ @safe string sp_char_esc(O)(
+ string _txt,
+ const O obj,
+ ) {
if (obj.metainfo.is_a != "code") {
- _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx.latex_special_char_for_escape);
- _txt = replaceAll!(m => "{\\" ~ m[1] ~ "}")(_txt, rgx.latex_special_char_for_escape_and_braces);
- _txt = replaceAll!(m => _unescape_sp_char_esc(m[0]))(_txt, rgx.latex_identify_inline_link);
- _txt = replaceAll!(m => _unescape_fontface_esc(m[0]))(_txt, rgx.latex_identify_inline_fontface);
+ _txt = _txt.sp_char_ops;
}
return _txt;
}
@safe string sp_char_esc_txt()(
string _txt,
) {
- string _unescape_sp_char_esc()(string _txt) {
- _txt = _txt
- .replaceAll(rgx.latex_special_char_escaped,
- format(q"┃%s┃", "$1"))
- .replaceAll(rgx.latex_special_char_escaped_braced,
- format(q"┃%s┃", "$1"));
- return _txt;
- }
- string _unescape_fontface_esc()(string _txt) {
- _txt = _txt.replaceAll(rgx.latex_identify_inline_fontface,
- format(q"┃%s%s┃", "$1", "$2"));
- return _txt;
- }
- _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx.latex_special_char_for_escape);
- _txt = replaceAll!(m => "{\\" ~ m[1] ~ "}")(_txt, rgx.latex_special_char_for_escape_and_braces);
- _txt = replaceAll!(m => _unescape_sp_char_esc(m[0]))(_txt, rgx.latex_identify_inline_link);
- _txt = replaceAll!(m => _unescape_fontface_esc(m[0]))(_txt, rgx.latex_identify_inline_fontface);
+ _txt = _txt.sp_char_ops;
return _txt;
}
@safe string fontface()(
@@ -371,8 +363,8 @@ template outputLaTeX() {
.replaceAll(rgx.inline_bold, format(q"┃\begin{bfseries}%s\end{bfseries}┃", "$1"))
.replaceAll(rgx.inline_italics, format(q"┃\emph{%s}┃", "$1"))
.replaceAll(rgx.inline_italics, format(q"┃\uline{%s}┃", "$1"))
- .replaceAll(rgx.inline_superscript, format(q"┃$$^{\textrm{%s}}$$┃", "$1"))
- .replaceAll(rgx.inline_subscript, format(q"┃$$_{\textrm{%s}}$$┃", "$1"))
+ .replaceAll(rgx.inline_superscript, format(q"┃$$^{%s}$$┃", "$1"))
+ .replaceAll(rgx.inline_subscript, format(q"┃$$_{%s}$$┃", "$1"))
.replaceAll(rgx.inline_strike, format(q"┃\sout{%s}┃", "$1"))
.replaceAll(rgx.inline_insert, format(q"┃\uline{%s}┃", "$1"))
.replaceAll(rgx.inline_mono, format(q"┃\begin{monosp}%s\end{monosp}┃", "$1"))
@@ -1107,16 +1099,16 @@ template outputLaTeX() {
){
links_mono_or_color_set = links.mono.strip;
}
- string _latex_head = format(q"┃%%%% spine LaTeX output
-%%%% Generated by: %s
-%%%% D version: %s
-%s
+ string _latex_head = format(q"┃%%%% spine LaTeX output%s%s%s
%%%% %s %s
%s
%s
%s
\setlength{\marginparsep}{4mm}
\setlength{\marginparwidth}{8mm}
+\usepackage[scaled]{dejavu}
+\renewcommand*\familydefault{\sfdefault}
+\usepackage{inconsolata}
\usepackage[T1]{fontenc}
%% \usepackage[utf8]{inputenc}
\usepackage[english]{babel}
@@ -1124,8 +1116,6 @@ template outputLaTeX() {
\usepackage{polyglossia}
\setmainlanguage{%s}
\setotherlanguage{%s}
-\setmainfont{Liberation Sans}
-\setmonofont[Scale=0.85]{Liberation Mono}
\usepackage{alltt}
\usepackage{hyperref}
\hypersetup{
@@ -1170,6 +1160,8 @@ template outputLaTeX() {
\usepackage{graphicx}
\usepackage[tc]{titlepic}
\usepackage{amssymb}
+\usepackage{amsmath}
+\usepackage[cm]{sfmath}
\usepackage{listings}
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{4}
@@ -1351,9 +1343,9 @@ template outputLaTeX() {
%% \usepackage{atbegshi} %% http://ctan.org/pkg/atbegshi %% (BUG tmp FIX deal with problem, remove first page which is blank)
%% \AtBeginDocument{\AtBeginShipoutNext{\AtBeginShipoutDiscard}} %% (BUG tmp FIX deal with problem, remove first page which is blank)
┃",
- doc_matters.opt.action.debug_do_latex ? "" : doc_matters.generator_program.name_and_version.strip,
- doc_matters.opt.action.debug_do_latex ? "" : doc_matters.generator_program.compiler.strip,
- doc_matters.opt.action.debug_do_latex ? "" : "", // "%%%% LaTeX output last Generated on: " ~ doc_matters.generator_program.stime.strip,
+ doc_matters.opt.action.generated_by ? " " ~ doc_matters.generator_program.name_and_version.strip : "",
+ doc_matters.opt.action.generated_by ? " (" ~ doc_matters.generator_program.compiler.strip ~ ")" : "",
+ doc_matters.opt.action.generated_by ? " (LaTeX output last Generated on: " ~ doc_matters.generator_program.stime.strip ~ ")" : "",
doc_matters.generator_program.project_name.strip,
doc_matters.generator_program.url_home.strip,
paper_size_orientation_latex.strip,