From e19cbce11d980238daa8f77b16ca0c7ec6c130ee Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 2 Mar 2022 16:26:51 -0500 Subject: latex, urls --- org/out_latex.org | 87 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 41 deletions(-) (limited to 'org') diff --git a/org/out_latex.org b/org/out_latex.org index 807010d..de73ab6 100644 --- a/org/out_latex.org +++ b/org/out_latex.org @@ -93,10 +93,8 @@ template outputLaTeX() { <> <> <> -<> <> <> -<> <> <> <> @@ -542,11 +540,13 @@ _txt = _txt 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); } } @@ -1153,7 +1153,7 @@ margins.portrait = format(q"┃ #+NAME: output_latex_head_tex_papermargins_portrait_set #+BEGIN_SRC latex \setlength{\oddsidemargin}{0mm} \setlength{\evensidemargin}{0mm} -\setlength{\topmargin}{-12pt} \setlength{\headheight}{12pt} +\setlength{\topmargin}{-0.5pt} \setlength{\headheight}{14.5pt} \setlength{\headsep}{35pt} #+END_SRC @@ -1173,7 +1173,7 @@ margins.landscape = format(q"┃ #+NAME: output_latex_head_tex_papermargins_landscape_set #+BEGIN_SRC latex \setlength{\oddsidemargin}{6mm} \setlength{\evensidemargin}{6mm} -\setlength{\topmargin}{-12mm} \setlength{\headheight}{12pt} +\setlength{\topmargin}{-0.5pt} \setlength{\headheight}{14.5pt} \setlength{\headsep}{20pt} #+END_SRC @@ -1241,11 +1241,11 @@ links.mono = format(q"┃ #+NAME: output_latex_head_tex_colorlinks_mono_set #+BEGIN_SRC latex -\usepackage[xetex, colorlinks=true, - urlcolor=myblack, - filecolor=myblack, - linkcolor=myblack, + urlcolor=black, + filecolor=black, + linkcolor=black, + citecolor=black, #+END_SRC #+NAME: output_latex_head_tex_colorlinks_mono_close @@ -1263,11 +1263,11 @@ links.color = format(q"┃ #+NAME: output_latex_head_tex_colorlinks_color_set #+BEGIN_SRC latex -\usepackage[xetex, 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 @@ -1459,37 +1459,42 @@ string _latex_head = format(q"┃%%%% spine LaTeX output #+BEGIN_SRC latex \usepackage{alltt} \usepackage{thumbpdf} +\usepackage{hyperref} +\hypersetup{ #+END_SRC -***** color links: no = mono | yes = color - -#+NAME: output_latex_head_tex_set_usepackages_color -#+BEGIN_SRC latex -%s -#+END_SRC - -***** metadata +***** hyperref metadata #+NAME: output_latex_head_tex_set_metadata #+BEGIN_SRC latex 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} #+END_SRC %% pdfusetitle=true, @@ -1516,12 +1521,6 @@ string _latex_head = format(q"┃%%%% spine LaTeX output ***** latex head -#+NAME: output_latex_head_tex_set_url -#+BEGIN_SRC latex -\usepackage{url} -\urlstyle{sf} -#+END_SRC - %%\usepackage{breakurl} ***** latex head @@ -1656,6 +1655,12 @@ string _latex_head = format(q"┃%%%% spine LaTeX output \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}}} } @@ -1703,10 +1708,10 @@ string _latex_head = format(q"┃%%%% spine LaTeX output 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), ); -- cgit v1.2.3