From 61409898f0cbd255c1019e1f988de1a978830fe9 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 19 Jul 2019 12:04:10 -0400 Subject: texpdf, footer & language setting --- org/output_latex.org | 69 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 55 insertions(+), 14 deletions(-) (limited to 'org/output_latex.org') diff --git a/org/output_latex.org b/org/output_latex.org index 4c3cf5f..eb50c46 100644 --- a/org/output_latex.org +++ b/org/output_latex.org @@ -26,15 +26,17 @@ template outputLaTeX() { mixin InternalMarkup; // watch mixin DocReformOutputRgxInit; auto rgx = Rgx(); + mixin DocReformLanguageCodes; + auto lang = Lang(); <> <> <> - <> + <> <> - <> - <> + <> + <> <> - <> + <> <> <> <> @@ -539,7 +541,8 @@ string bullets_and_indentation(O)( ) { _indent = ((obj.attrib.indent_base * _indent_increment) + _paper_margin).to!string; _hang = (((obj.attrib.indent_hang - obj.attrib.indent_base) * _indent_increment)).to!string; - _txt = format(q"┃\begin{ParagraphHang}{%smm}{%smm}%s \end{ParagraphHang}┃", + _tex_para = q"┃\begin{ParagraphHang}{%smm}{%smm}%s \end{ParagraphHang}┃"; + _txt = format(_tex_para, _indent, _hang, _txt.footnotes ).strip; @@ -962,9 +965,44 @@ string latex_head(M)( auto paper = paperType(); #+END_SRC +****** footer + +#+name: output_latex_head +#+BEGIN_SRC d + string _footer(M)(M doc_matters) { + writeln("footer: ", doc_matters.conf_make_meta.make.footer); + string _ft = "\\lfoot[\\textrm{\\thepage}]"; + string _ft_1 = format(q"┃{\tiny \href{%s}{%s}}┃", "http://sisudoc.org", "SiSU",); + string _ft_2 = format(q"┃ +\cfoot{\href{%s}{%s}}┃", "http://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)) { + _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; + } + } + } else { + _ft ~= _ft_1; + _ft ~= _ft_2; + } + return _ft; + } +#+END_SRC + ****** a4, portrait -#+name: output_latex_head_1 +#+name: output_latex_head_1_format_string #+BEGIN_SRC d paper.a4_portrait = format(q"┃ #+END_SRC @@ -1177,7 +1215,7 @@ string latex_head(M)( linkcolor=myred, %% \href{...} and \pageref{...} #+END_SRC -#+name: output_latex_head_1_close +#+name: output_latex_head_1_format_string_variables #+BEGIN_SRC d ┃", ); @@ -1185,7 +1223,7 @@ string latex_head(M)( **** latex head starts -#+name: output_latex_head_0 +#+name: output_latex_head_0_format_string #+BEGIN_SRC d string _latex_head = format(q"┃%%%% DocReform LaTeX output #+END_SRC @@ -1243,8 +1281,8 @@ string latex_head(M)( #+name: output_latex_head_0_tex #+BEGIN_SRC latex \usepackage{polyglossia, ucs, fontspec, xltxtra, xunicode} -\setmainlanguage{english} -\setotherlanguage{} +\setmainlanguage{%s} +\setotherlanguage{%s} \setmainfont{Liberation Sans} \setmonofont[Scale=0.85]{Liberation Mono} #+END_SRC @@ -1427,12 +1465,11 @@ string latex_head(M)( #+name: output_latex_head_0_tex #+BEGIN_SRC latex -\selectlanguage{english} +\selectlanguage{%s} \lhead[ ]{ } \chead[ \fancyplain{} \bfseries \footnotesize \leftmark ]{ \fancyplain{} \bfseries \footnotesize \rightmark } \rhead[ ]{ } -\lfoot[\textrm{\thepage}]{\tiny \href{http://sisudoc.org}{SiSU}} -\cfoot{\href{http://git.sisudoc.org}{git}} +%s \rfoot[\tiny \href{}{}]{\textrm{\thepage}} \tolerance=300 \clubpenalty=300 @@ -1487,17 +1524,21 @@ string latex_head(M)( **** latex head format inclusions -#+name: output_latex_head_0_close +#+name: output_latex_head_0_format_string_variables #+BEGIN_SRC d ┃", doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.name_and_version.strip, paper.a4_portrait.strip, margins.portrait.strip, multicol.portrait.strip, + lang.codes[doc_matters.src.language]["xlp"], + "english", links.mono.strip, // links.color.strip, 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, + lang.codes[doc_matters.src.language]["xlp"], + _footer(doc_matters), ); #+END_SRC -- cgit v1.2.3