From b8d295e13b3ab8176190ab86b54b4badd54313b6 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 1 Mar 2022 12:05:55 -0500 Subject: latex \newcommand: \ocn for ocn with margin --- src/doc_reform/io_out/latex.d | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d index 6160a3e..d87a938 100644 --- a/src/doc_reform/io_out/latex.d +++ b/src/doc_reform/io_out/latex.d @@ -382,9 +382,8 @@ template outputLaTeX() { ) { if (obj.metainfo.is_of_type == "para") { string _tex_para; - _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}%s┃"; + _tex_para = q"┃\ocn{%s}%s┃"; _txt = format(_tex_para, - obj.metainfo.object_number, obj.metainfo.object_number, _txt.footnotes ).strip; @@ -483,13 +482,12 @@ template outputLaTeX() { ); } else if (obj.metainfo.heading_lev_markup < 4) { if (!(_txt.footnotes.strip == "Endnotes")) { - _tex_para = q"┃%s\part*{\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}%s} + _tex_para = q"┃%s\part*{\ocn{%s}%s} \addcontentsline{toc}{part}{%s} \markboth{%s}┃"; _txt = format(_tex_para, _pg_break, obj.metainfo.object_number, - obj.metainfo.object_number, _txt.strip.footnotes, _txt.strip.remove_footnotes, (doc_matters.conf_make_meta.meta.title_main).sp_char_esc_txt, @@ -502,7 +500,7 @@ template outputLaTeX() { \pagenumbering{none} \setcounter{page}{1} \setlength{\parskip}{1ex plus0.5ex minus0.2ex} -\part*{\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{1}{1}\end{tiny}}}%s \newline %s} +\part*{\ocn{1}%s \newline %s} \clearpage \markboth{%s}{%s} @@ -532,13 +530,12 @@ template outputLaTeX() { && _part == "bookindex" && _txt.match(regex(r"^Index$")) ) { - _tex_para = q"┃%s\%s*{\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}%s} + _tex_para = q"┃%s\%s*{\ocn{%s}%s} \addcontentsline{toc}{%s}{%s%s}%s%s┃"; _txt = format(_tex_para, _pg_break, _sect.strip, obj.metainfo.object_number, - obj.metainfo.object_number, _txt.footnotes.strip, _sect, _txt.remove_footnotes.strip, @@ -551,13 +548,12 @@ template outputLaTeX() { ) { /+ dummy headings completely omitted +/ _txt = ""; } else { - _tex_para = q"┃%s\%s*{\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}%s} + _tex_para = q"┃%s\%s*{\ocn{%s}%s} \addcontentsline{toc}{%s}{%s%s}%s┃"; _txt = format(_tex_para, _pg_break, _sect.strip, obj.metainfo.object_number, - obj.metainfo.object_number, _txt.footnotes.strip, _sect, _txt.remove_footnotes.strip, @@ -578,13 +574,12 @@ string group(O,M)( ) { if (obj.metainfo.is_a == "group") { string _tex_para; - _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex} + _tex_para = q"┃\ocn{%s}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex} \begin{footnotesize} %s \end{footnotesize} ┃"; _txt = format(_tex_para, - obj.metainfo.object_number, obj.metainfo.object_number, _txt.footnotes.strip ).strip; @@ -599,7 +594,7 @@ string block(O,M)( if (obj.metainfo.is_a == "block") { // _txt = _txt.nbsp_char; string _tex_para; - _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex} + _tex_para = q"┃\ocn{%s}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex} \begin{footnotesize} %s \end{footnotesize} @@ -608,7 +603,6 @@ string block(O,M)( /+ try both: +/ _txt = _txt.split(rgx.br_newlines_linebreaks).join("\n\n"); // _txt = _txt.split(rgx.br_newlines_linebreaks).join(" \\\n"); _txt = format(_tex_para, - obj.metainfo.object_number, obj.metainfo.object_number, _txt.nbsp_char.footnotes.strip ).strip; @@ -622,7 +616,7 @@ string verse(O,M)( ) { if (obj.metainfo.is_a == "verse") { string _tex_para; - _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}\setlength{\parskip}{0.1ex plus0.1ex minus0.1ex} + _tex_para = q"┃\ocn{%s}\setlength{\parskip}{0.1ex plus0.1ex minus0.1ex} \begin{footnotesize} %s @@ -632,7 +626,6 @@ string verse(O,M)( \linebreak ┃"; // \hardspace _txt = format(_tex_para, - obj.metainfo.object_number, obj.metainfo.object_number, _txt.nbsp_char.footnotes.split("\n").join("\n\n").strip ).strip; @@ -646,7 +639,7 @@ string codeblock(O,M)( ) { if (obj.metainfo.is_a == "code") { string _tex_para; - _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}\begin{Codeblock} + _tex_para = q"┃\ocn{%s}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}\begin{Codeblock} \begin{lstlisting} %s \end{lstlisting} @@ -654,7 +647,6 @@ string codeblock(O,M)( \setlength{\parskip}{1ex plus0.5ex minus0.2ex} ┃"; _txt = format(_tex_para, - obj.metainfo.object_number, obj.metainfo.object_number, _txt.nbsp_char_to_space ).strip; @@ -728,7 +720,7 @@ string table(O,M)( ); } string _tex_para; - _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}} + _tex_para = q"┃\ocn{%s} \setlength{\LTleft}{0pt} \setlength{\LTright}{\fill} \begin{tiny} @@ -738,7 +730,6 @@ string table(O,M)( \end{tiny} ┃"; _txt = format(_tex_para, - obj.metainfo.object_number, obj.metainfo.object_number, _colw, _table, @@ -1085,6 +1076,9 @@ string table(O,M)( \newcommand{\slash}{{/}} \newcommand{\underscore}{\_} \newcommand{\exclaim}{\Verbatim{!}} +\newcommand{\ocn}[1]{ +\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{#1}{#1}\end{tiny}}} +} \definecolor{listinggray}{gray}{0.9} \definecolor{lbcolor}{rgb}{0.9,0.9,0.9} \lstset{ -- cgit v1.2.3