aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/io_out/latex.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2022-03-02 16:26:51 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2022-03-05 10:33:48 -0500
commite19cbce11d980238daa8f77b16ca0c7ec6c130ee (patch)
treea5c8d20337e837d48f01bcfbc9dc2acb5fecb1e3 /src/doc_reform/io_out/latex.d
parentlatex \newcommand: \ocn for ocn with margin (diff)
latex, urls
Diffstat (limited to 'src/doc_reform/io_out/latex.d')
-rw-r--r--src/doc_reform/io_out/latex.d83
1 files changed, 50 insertions, 33 deletions
diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d
index d87a938..48afecb 100644
--- a/src/doc_reform/io_out/latex.d
+++ b/src/doc_reform/io_out/latex.d
@@ -343,11 +343,13 @@ template outputLaTeX() {
m[1] ~ "┤" ~ to!string((obj.stow.link[m[2].to!ulong])).encode ~ "├"
)(_txt, rgx.inline_link_number_only);
_txt = replaceAll!(m =>
- ((m[1] == m[2]) && (m[2].match(rgx.uri)))
- ? format(q"┃\begin{scriptsize}\lefthalfcap\url{%s}\righthalfcup\end{scriptsize}┃", _check_link(m[1]))
- : (m[2].match(rgx.uri)) // ERROR
- ? format(q"┃%s\href{%s}%s{%s}┃", "\\\\\n", _check_link(m[2]), "\n", _if_images(m[1]))
- : format(q"┃\hyperlink{%s}{%s}┃", _check_link(m[2]), _if_images(m[1]))
+ ((m[1] == m[2]) && (m[2].match(rgx.uri))) // url link (regular link with url)
+ ? format(q"┃\linkurl{%s}{%s}┃", _check_link(m[1]), (_check_link(m[1])).sp_char_esc_txt)
+ : ((m[2].match(rgx.uri)) && (m[1].match(rgx.inline_image_info))) // linked image
+ ? format(q"┃%s\href{%s}%s{%s}┃", "\\\\\n", _check_link(m[2]), "\n", _if_images(m[1])) // markup for images
+ : (m[2].match(rgx.uri)) // not linked image
+ ? format(q"┃%s\linktext{%s}{%s}┃", "\\\\\n", _check_link(m[2]), m[1]) // regular link with text
+ : format(q"┃\hyperlink{%s}{%s}┃", _check_link(m[2]), _if_images(m[1])) // internal links, like book index
)(_txt, rgx.inline_link);
}
}
@@ -828,13 +830,13 @@ string table(O,M)(
auto margins = paperMargins();
margins.portrait = format(q"┃
\setlength{\oddsidemargin}{0mm} \setlength{\evensidemargin}{0mm}
-\setlength{\topmargin}{-12pt} \setlength{\headheight}{12pt}
+\setlength{\topmargin}{-0.5pt} \setlength{\headheight}{14.5pt}
\setlength{\headsep}{35pt}
┃",
);
margins.landscape = format(q"┃
\setlength{\oddsidemargin}{6mm} \setlength{\evensidemargin}{6mm}
-\setlength{\topmargin}{-12mm} \setlength{\headheight}{12pt}
+\setlength{\topmargin}{-0.5pt} \setlength{\headheight}{14.5pt}
\setlength{\headsep}{20pt}
┃",
);
@@ -854,19 +856,19 @@ string table(O,M)(
}
auto links = colorLinks();
links.mono = format(q"┃
-\usepackage[xetex,
- colorlinks=true,
- urlcolor=myblack,
- filecolor=myblack,
- linkcolor=myblack,
+colorlinks=true,
+urlcolor=black,
+filecolor=black,
+linkcolor=black,
+citecolor=black,
┃",
);
links.color = format(q"┃
-\usepackage[xetex,
- colorlinks=true,
- urlcolor=myblue, %% \href{...}{...} external url
- filecolor=mygreen, %% \href{...} local file
- linkcolor=myred, %% \href{...} and \pageref{...}
+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,) {
@@ -943,33 +945,42 @@ string table(O,M)(
\setmonofont[Scale=0.85]{Liberation Mono}
\usepackage{alltt}
\usepackage{thumbpdf}
-%s
+\usepackage{hyperref}
+\hypersetup{
pdftitle={%s},
pdfauthor={%s},
pdfsubject={%s},
- pdfkeywords={},
- pageanchor=true,
- plainpages=true,
- pdfpagelabels=true,
- pagebackref,
- bookmarks=true,
- bookmarksopen=true,
+ pdfkeywords={}, %% keywords list {} {} {},
+ pdftoolbar=true,
pdfmenubar=true,
pdfpagemode=UseOutline,
- pdffitwindow=true,
pdfwindowui=true,
- plainpages=false,
- pdfstartview=FitH
-]
-{hyperref}
+ pdffitwindow=false, %% window fit to page when opened
+ pdfstartview={FitH}, %% fits the width of the page to the window
+ pdfnewwindow=true, %% links in new window
+ pdfpagelabels=true,
+ pageanchor=true,
+ pagebackref=true,
+ plainpages=false, %% was true
+ bookmarks=true,
+ bookmarksopen=false,
+ %% colorlinks=true,
+ %% urlcolor=black,
+ %% filecolor=black,
+ %% linkcolor=black,
+ %% citecolor=black,
+%s %% links_mono_or_color_set
+ pdfpublisher={}, %% document publisher
+ pdfcreator={}, %% document creator
+ pdfproducer={}, %% document producer
+}
+\PassOptionsToPackage{hyphens}{url}\usepackage{hyperref}
\usepackage[usenames]{color}
\definecolor{myblack}{rgb}{0,0,0}
\definecolor{myred}{rgb}{0.75,0,0}
\definecolor{mygreen}{rgb}{0,0.5,0}
\definecolor{myblue}{rgb}{0,0,0.5}
\definecolor{mywhite}{rgb}{1,1,1}
-\usepackage{url}
-\urlstyle{sf}
\usepackage{textcomp}
\usepackage[parfill]{parskip}
\usepackage[normalem]{ulem}
@@ -1076,6 +1087,12 @@ string table(O,M)(
\newcommand{\slash}{{/}}
\newcommand{\underscore}{\_}
\newcommand{\exclaim}{\Verbatim{!}}
+\newcommand{\linktext}[2]{{\href{#1}
+{\ulcorner\textup{{#2}}\lrcorner}}}
+\newcommand{\linkurl}[2]{{\href{#1}
+{\scriptsize\ttfamily\ulcorner\textup{{#2}}\lrcorner}}}
+\newcommand{\link}[2]{{\begin{scriptsize}\color{black}\urlstyle{tt}\href{#1}
+{\ulcorner{#2}\lrcorner}\end{scriptsize}}}
\newcommand{\ocn}[1]{
\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{#1}{#1}\end{tiny}}}
}
@@ -1114,10 +1131,10 @@ string table(O,M)(
multicol.portrait.strip,
lang.codes[doc_matters.src.language]["xlp"],
"english",
- links_mono_or_color_set,
doc_matters.conf_make_meta.meta.title_full.strip,
doc_matters.conf_make_meta.meta.creator_author.strip,
doc_matters.conf_make_meta.meta.classify_subject.strip,
+ links_mono_or_color_set,
lang.codes[doc_matters.src.language]["xlp"],
_footer(doc_matters),
);