From 6d74d9fa63bc478fcd56a2edf4bdb9906efa1966 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 24 Mar 2022 21:12:43 -0400 Subject: latex header, work on (& some code formatting) --- src/doc_reform/io_out/latex.d | 694 ++++++++++++++++----------------- src/doc_reform/meta/metadoc_from_src.d | 2 +- 2 files changed, 343 insertions(+), 353 deletions(-) (limited to 'src') diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d index ca809d5..1f58c35 100644 --- a/src/doc_reform/io_out/latex.d +++ b/src/doc_reform/io_out/latex.d @@ -651,43 +651,16 @@ template outputLaTeX() { goto default; default: if (obj.metainfo.heading_lev_markup == 0) { - _tex_para = q"┃\begin{document} -\DeclareTOCStyleEntry[numwidth+=8pt]{part}{part} -\DeclareTOCStyleEntry[numwidth+=4pt]{section}{section} -\DeclareTOCStyleEntry[numwidth+=3pt]{section}{paragraph} -\DeclareTOCStyleEntry[numwidth+=3pt]{section}{subparagraph} -\DeclareTOCStyleEntry[numwidth+=3pt]{section}{subsection} -\DeclareTOCStyleEntries[indent+=4pt]{section}{section,subsection,subsubsection} -\DeclareTOCStyleEntries[numwidth+=3pt]{section}{paragraph,subparagraph} -\RedeclareSectionCommand[%% - style=section, - level=0, - indent=\z@, - beforeskip=-3.5ex \@plus -1ex \@minus -.2ex, - afterskip=2.3ex \@plus.2ex, - tocindent=0pt, - tocnumwidth=1.5em - ]{part} -\RedeclareSectionCommands[%% - tocnumwidth+=4pt, - tocindent+=4pt, - style=section, - beforeskip=-0pt, - afterskip=4pt, - afterindent=false, - indent=0pt]{section,subsection,subsubsection} -\RedeclareSectionCommands[%% - beforeskip=-10pt plus -2pt minus -1pt, - afterskip=1sp plus -1sp minus 1sp, - font=\normalfont\itshape, - indent=0pt]{paragraph,subparagraph} -\title{%s} + _tex_para = q"┃ +\begin{document} +\thispagestyle{empty} +\title{%s%s} \author{ \textnormal{%s}} \date{\begin{tiny}%s\end{tiny}} -\thispagestyle{empty} \maketitle -\pagestyle{fancy} +\addcontentsline{toc}{part}{%s} \newpage +\pagestyle{fancy} \pagenumbering{alph} \setcounter{page}{1} \markboth{%s}{%s} @@ -695,10 +668,13 @@ template outputLaTeX() { %s \clearpage┃"; _txt = format(_tex_para, - (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt, + (doc_matters.conf_make_meta.meta.title_main).sp_char_esc_txt, + doc_matters.conf_make_meta.meta.title_subtitle.empty ? "" + : " \\\\ - \\\\ " ~ (doc_matters.conf_make_meta.meta.title_subtitle).sp_char_esc_txt, (doc_matters.conf_make_meta.meta.creator_author).sp_char_esc_txt, (doc_matters.conf_make_meta.meta.date_published).sp_char_esc_txt, (doc_matters.conf_make_meta.meta.title_main).sp_char_esc_txt, + (doc_matters.conf_make_meta.meta.title_main).sp_char_esc_txt, (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt, (doc_matters.conf_make_meta.meta.rights_copyright).sp_char_esc_txt, (doc_matters.conf_make_meta.meta.rights_license).sp_char_esc_txt, @@ -738,7 +714,7 @@ template outputLaTeX() { \markboth{%s}{%s} %% \null \clearpage -\setcounter{page}{1}┃"; +\setcounter{page}{2}┃"; _txt = format(_tex_para, (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt, (doc_matters.conf_make_meta.meta.creator_author).sp_char_esc_txt, @@ -786,158 +762,158 @@ template outputLaTeX() { } return _txt.strip; } -string group(O,M)( - string _txt, - O obj, - M doc_matters, -) { - if (obj.metainfo.is_a == "group") { - string _tex_para; - _tex_para = q"┃\ocn{%s}\objGroupOpen + string group(O,M)( + string _txt, + O obj, + M doc_matters, + ) { + if (obj.metainfo.is_a == "group") { + string _tex_para; + _tex_para = q"┃\ocn{%s}\objGroupOpen %s \objGroupClose ┃"; - _txt = format(_tex_para, - obj.metainfo.object_number, - _txt.footnotes.split(rgx.br_line_spaced).join("\\brl{1}").strip // provides more control (more noise, not as tidy) - // _txt.footnotes.split(rgx.br_line_spaced).join("") // this works using a line-space, looks tidy, keep ref. - ).strip; + _txt = format(_tex_para, + obj.metainfo.object_number, + _txt.footnotes.split(rgx.br_line_spaced).join("\\brl{1}").strip // provides more control (more noise, not as tidy) + // _txt.footnotes.split(rgx.br_line_spaced).join("") // this works using a line-space, looks tidy, keep ref. + ).strip; + } + return _txt; } - return _txt; -} -string block(O,M)( - string _txt, - O obj, - M doc_matters, -) { - if (obj.metainfo.is_a == "block") { - string _tex_para; - _tex_para = q"┃\ocn{%s}\objBlockOpen + string block(O,M)( + string _txt, + O obj, + M doc_matters, + ) { + if (obj.metainfo.is_a == "block") { + string _tex_para; + _tex_para = q"┃\ocn{%s}\objBlockOpen %s \objBlockClose ┃"; - _txt = format(_tex_para, - obj.metainfo.object_number, - _txt.nbsp_char.footnotes.split(rgx.br_linebreaks_newlines).join("\\br\n").strip - ).strip; + _txt = format(_tex_para, + obj.metainfo.object_number, + _txt.nbsp_char.footnotes.split(rgx.br_linebreaks_newlines).join("\\br\n").strip + ).strip; + } + return _txt; } - return _txt; -} -string verse(O,M)( - string _txt, - O obj, - M doc_matters, -) { - if (obj.metainfo.is_a == "verse") { - string _tex_para; - _tex_para = q"┃\ocn{%s}\objPoemVerseOpen + string verse(O,M)( + string _txt, + O obj, + M doc_matters, + ) { + if (obj.metainfo.is_a == "verse") { + string _tex_para; + _tex_para = q"┃\ocn{%s}\objPoemVerseOpen %s \objPoemVerseClose ┃"; - _txt = format(_tex_para, - obj.metainfo.object_number, - _txt.spaces_to_nbsp.footnotes.split(rgx.br_linebreaks_newlines).join("\\br\n").strip - ).strip; + _txt = format(_tex_para, + obj.metainfo.object_number, + _txt.spaces_to_nbsp.footnotes.split(rgx.br_linebreaks_newlines).join("\\br\n").strip + ).strip; + } + return _txt; } - return _txt; -} -string codeblock(O,M)( - string _txt, - O obj, - M doc_matters, -) { - if (obj.metainfo.is_a == "code") { - string _tex_para; - _tex_para = q"┃\ocn{%s}\begin{objCodeBlock}\begin{lstlisting} + string codeblock(O,M)( + string _txt, + O obj, + M doc_matters, + ) { + if (obj.metainfo.is_a == "code") { + string _tex_para; + _tex_para = q"┃\ocn{%s}\begin{objCodeBlock}\begin{lstlisting} %s \end{lstlisting}\end{objCodeBlock} ┃"; - _txt = format(_tex_para, - obj.metainfo.object_number, - _txt.nbsp_char_to_space - ).strip; + _txt = format(_tex_para, + obj.metainfo.object_number, + _txt.nbsp_char_to_space + ).strip; + } + return _txt; } - return _txt; -} -auto tablarize(O)( - string _txt, - const O obj, -) { - string[] _table_rows = (_txt).split(rgx.table_delimiter_row); - string[] _table_cols; - string _table; - string _tablenote; - foreach(row_idx, row; _table_rows) { - _table_cols = row.split(rgx.table_delimiter_col); - _table ~= ""; - foreach(col_idx, cell; _table_cols) { - if ((_table_cols.length == 1) - && (_table_rows.length <= row_idx+2)) { // check row_idx+2 (rather than == ++row_idx) - _tablenote ~= cell; - } else { - // // _table ~= "\\bfseries "; - // _table ~= cell; - // _table ~= (_table_cols.length > (col_idx + 1)) ? "&" : ""; - _table ~= format(q"┃%s%s┃", - cell, - (_table_cols.length > (col_idx + 1)) ? "&" : "" - ); + auto tablarize(O)( + string _txt, + const O obj, + ) { + string[] _table_rows = (_txt).split(rgx.table_delimiter_row); + string[] _table_cols; + string _table; + string _tablenote; + foreach(row_idx, row; _table_rows) { + _table_cols = row.split(rgx.table_delimiter_col); + _table ~= ""; + foreach(col_idx, cell; _table_cols) { + if ((_table_cols.length == 1) + && (_table_rows.length <= row_idx+2)) { // check row_idx+2 (rather than == ++row_idx) + _tablenote ~= cell; + } else { + // // _table ~= "\\bfseries "; + // _table ~= cell; + // _table ~= (_table_cols.length > (col_idx + 1)) ? "&" : ""; + _table ~= format(q"┃%s%s┃", + cell, + (_table_cols.length > (col_idx + 1)) ? "&" : "" + ); + } } + _table ~= "\\\\"; } - _table ~= "\\\\"; + Tuple!(string, string) t = tuple( + _table, + _tablenote, + ); + return t; } - Tuple!(string, string) t = tuple( - _table, - _tablenote, - ); - return t; -} -string table(O,M)( - string _txt, - O obj, - M doc_matters, - string paper_size_orientation, -) { - if (obj.metainfo.is_a == "table") { - auto _t = _txt.tablarize(obj); - string _table = _t[0]; - string _t_n = _t[1]; - uint pw = 0; - switch (paper_size_orientation) { - case "a4.portrait": pw = (paper.a4.portrait.w - 20); break; - case "a4.landscape": pw = (paper.a4.landscape.w - 20); break; - case "b4.portrait": pw = (paper.b4.portrait.w - 20); break; - case "b4.landscape": pw = (paper.b4.landscape.w - 20); break; - case "a5.portrait": pw = (paper.a5.portrait.w - 20); break; - case "a5.landscape": pw = (paper.a5.landscape.w - 20); break; - case "letter.portrait": pw = (paper.letter.portrait.w - 20); break; - case "letter.landscape": pw = (paper.letter.landscape.w - 20); break; - case "legal.portrait": pw = (paper.legal.portrait.w - 20); break; - case "legal.landscape": pw = (paper.legal.landscape.w - 20); break; - default: pw = 0; break; - } - // auto textwidth = (pw - 24); - string _colw = ""; - foreach (w; obj.table.column_widths) { - _colw ~= format(q"┃p{%.0fmm}┃", - (w * pw / 100) - // (w * (pw - 24)/ 100) - // (w * textwidth / 100) - ); - } - string _tex_para; - _tex_para = q"┃\ocn{%s}\objTableOpen{%s} + string table(O,M)( + string _txt, + O obj, + M doc_matters, + string paper_size_orientation, + ) { + if (obj.metainfo.is_a == "table") { + auto _t = _txt.tablarize(obj); + string _table = _t[0]; + string _t_n = _t[1]; + uint pw = 0; + switch (paper_size_orientation) { + case "a4.portrait": pw = (paper.a4.portrait.w - 20); break; + case "a4.landscape": pw = (paper.a4.landscape.w - 20); break; + case "b4.portrait": pw = (paper.b4.portrait.w - 20); break; + case "b4.landscape": pw = (paper.b4.landscape.w - 20); break; + case "a5.portrait": pw = (paper.a5.portrait.w - 20); break; + case "a5.landscape": pw = (paper.a5.landscape.w - 20); break; + case "letter.portrait": pw = (paper.letter.portrait.w - 20); break; + case "letter.landscape": pw = (paper.letter.landscape.w - 20); break; + case "legal.portrait": pw = (paper.legal.portrait.w - 20); break; + case "legal.landscape": pw = (paper.legal.landscape.w - 20); break; + default: pw = 0; break; + } + // auto textwidth = (pw - 24); + string _colw = ""; + foreach (w; obj.table.column_widths) { + _colw ~= format(q"┃p{%.0fmm}┃", + (w * pw / 100) + // (w * (pw - 24)/ 100) + // (w * textwidth / 100) + ); + } + string _tex_para; + _tex_para = q"┃\ocn{%s}\objTableOpen{%s} %s \objTableClose ┃"; - _txt = format(_tex_para, - obj.metainfo.object_number, - _colw, - _table, - ).strip; + _txt = format(_tex_para, + obj.metainfo.object_number, + _colw, + _table, + ).strip; + } + return _txt; } - return _txt; -} @safe string bullets_and_indentation(O)( string _txt, O obj, @@ -1022,47 +998,47 @@ string table(O,M)( } return _ft; } - struct paperMargins { - string portrait; - string landscape; - } - auto margins = paperMargins(); - struct columnsMulti { - string portrait; - string landscape; - } - auto multicol = columnsMulti(); - multicol.portrait = format(q"┃ + struct paperMargins { + string portrait; + string landscape; + } + auto margins = paperMargins(); + struct columnsMulti { + string portrait; + string landscape; + } + auto multicol = columnsMulti(); + multicol.portrait = format(q"┃ \usepackage{multicol} ┃", - ); - multicol.landscape = ""; - struct colorLinks { - string mono; - string color; - } - auto links = colorLinks(); - links.mono = format(q"┃ + ); + multicol.landscape = ""; + struct colorLinks { + string mono; + string color; + } + auto links = colorLinks(); + links.mono = format(q"┃ colorlinks=true, urlcolor=black, filecolor=black, linkcolor=black, citecolor=black, ┃", - ); - links.color = format(q"┃ + ); + links.color = format(q"┃ 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,) { - string paper_type_description; - if (paper_set.is_portrait) { - paper_type_description = format(q"┃ -\documentclass[%s,%s,titlepage]{scrartcl} + ); + string set_paper(P)(P paper_set,) { + string paper_type_description; + if (paper_set.is_portrait) { + paper_type_description = format(q"┃ +\documentclass[%s,%s,titlepage,makeidx]{scrartcl} \usepackage{geometry} \geometry{ %s, @@ -1072,18 +1048,18 @@ string table(O,M)( top=%s, bottom=%s, }┃", - paper_set.fontsize, - paper_set.papersize, - paper_set.papersize, - paper_set.orient, - paper_set.margin_left, - paper_set.margin_right, - paper_set.margin_top, - paper_set.margin_bottom, - ); - } else { - paper_type_description = format(q"┃ -\documentclass[%s,%s,landscape,titlepage,twocolumn]{scrartcl} + paper_set.fontsize, + paper_set.papersize, + paper_set.papersize, + paper_set.orient, + paper_set.margin_left, + paper_set.margin_right, + paper_set.margin_top, + paper_set.margin_bottom, + ); + } else { + paper_type_description = format(q"┃ +\documentclass[%s,%s,landscape,titlepage,twocolumn,makeidx]{scrartcl} \usepackage{geometry} \geometry{ %s, @@ -1093,54 +1069,54 @@ string table(O,M)( top=%s, bottom=%s, }┃", - paper_set.fontsize, - paper_set.papersize, - paper_set.papersize, - paper_set.orient, - paper_set.margin_left, - paper_set.margin_right, - paper_set.margin_top, - paper_set.margin_bottom, - ); + paper_set.fontsize, + paper_set.papersize, + paper_set.papersize, + paper_set.orient, + paper_set.margin_left, + paper_set.margin_right, + paper_set.margin_top, + paper_set.margin_bottom, + ); + } + return paper_type_description; } - return paper_type_description; - } - string paper_size_orientation_latex; - switch (paper_size_orientation) { - case "a4.portrait": paper_size_orientation_latex = set_paper(paper.a4.portrait); break; - case "a4.landscape": paper_size_orientation_latex = set_paper(paper.a4.landscape); break; - case "b4.portrait": paper_size_orientation_latex = set_paper(paper.b4.portrait); break; - case "b4.landscape": paper_size_orientation_latex = set_paper(paper.b4.landscape); break; - case "a5.portrait": paper_size_orientation_latex = set_paper(paper.a5.portrait); break; - case "a5.landscape": paper_size_orientation_latex = set_paper(paper.a5.landscape); break; - case "letter.portrait": paper_size_orientation_latex = set_paper(paper.letter.portrait); break; - case "letter.landscape": paper_size_orientation_latex = set_paper(paper.letter.landscape); break; - case "legal.portrait": paper_size_orientation_latex = set_paper(paper.legal.portrait); break; - case "legal.landscape": paper_size_orientation_latex = set_paper(paper.legal.landscape); break; - default: paper_size_orientation_latex = paper_type_latex.a4_portrait; - } - string links_mono_or_color_set = links.mono.strip; - if ( - (doc_matters.opt.action.latex_color_links) - || (paper_size_orientation == - "a4.landscape" || - "a5.landscape" || - "b4.landscape" || - "letter.landscape" || - "legal.landscape") - ){ - links_mono_or_color_set = links.mono.strip; - } - string _latex_head = format(q"┃%%%% spine LaTeX output + string paper_size_orientation_latex; + switch (paper_size_orientation) { + case "a4.portrait": paper_size_orientation_latex = set_paper(paper.a4.portrait); break; + case "a4.landscape": paper_size_orientation_latex = set_paper(paper.a4.landscape); break; + case "b4.portrait": paper_size_orientation_latex = set_paper(paper.b4.portrait); break; + case "b4.landscape": paper_size_orientation_latex = set_paper(paper.b4.landscape); break; + case "a5.portrait": paper_size_orientation_latex = set_paper(paper.a5.portrait); break; + case "a5.landscape": paper_size_orientation_latex = set_paper(paper.a5.landscape); break; + case "letter.portrait": paper_size_orientation_latex = set_paper(paper.letter.portrait); break; + case "letter.landscape": paper_size_orientation_latex = set_paper(paper.letter.landscape); break; + case "legal.portrait": paper_size_orientation_latex = set_paper(paper.legal.portrait); break; + case "legal.landscape": paper_size_orientation_latex = set_paper(paper.legal.landscape); break; + default: paper_size_orientation_latex = paper_type_latex.a4_portrait; + } + string links_mono_or_color_set = links.mono.strip; + if ( + (doc_matters.opt.action.latex_color_links) + || (paper_size_orientation == + "a4.landscape" || + "a5.landscape" || + "b4.landscape" || + "letter.landscape" || + "legal.landscape") + ){ + links_mono_or_color_set = links.mono.strip; + } + string _latex_head = format(q"┃%%%% spine LaTeX output %%%% Generated by: %s %%%% D version: %s %s %%%% %s %s %s %s +%s \setlength{\marginparsep}{4mm} \setlength{\marginparwidth}{8mm} -%s \usepackage[T1]{fontenc} %% \usepackage[utf8]{inputenc} \usepackage[english]{babel} @@ -1153,6 +1129,8 @@ string table(O,M)( \usepackage{alltt} \usepackage{hyperref} \hypersetup{ + unicode=true, + pdfusetitle, pdftitle={%s}, pdfauthor={%s}, pdfsubject={%s}, @@ -1163,8 +1141,13 @@ string table(O,M)( 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 + pdfborder={0 0 1}, plainpages=false, %% was true + bookmarks=true, bookmarksopen=false, + bookmarksnumbered=false, + backref=false, + breaklinks=false, %% colorlinks=true, %% urlcolor=black, %% filecolor=black, @@ -1184,71 +1167,91 @@ string table(O,M)( \usepackage[normalem]{ulem} \usepackage{soul} \usepackage{longtable} -\usepackage[tc]{titlepic} \usepackage{graphicx} -\makeatletter -\parindent{0pt} +\usepackage[tc]{titlepic} \usepackage{amssymb} \usepackage{listings} -\usepackage{color} -\usepackage{textcomp} \setcounter{secnumdepth}{2} \setcounter{tocdepth}{4} +\usepackage{bookmark} +\usepackage{microtype} \makeatletter \usepackage[multiple,ragged]{footmisc} \setlength\footnotemargin{12pt} \usepackage[para]{manyfoot} \DeclareNewFootnote{A} -\newenvironment{ParagraphIndent}[1]%% -{ -\begin{list}{}{%% -\setlength\topsep{0pt}%% -\addtolength{\leftmargin}{#1} -\setlength\parsep{0pt plus 1pt}%% -} -\item[] -} -{\end{list}} -\newenvironment{ParagraphHang}[2]%% -{ -\begin{list}{}{%% -\setlength\topsep{0pt}%% -\addtolength{\leftmargin}{#1} -\itemindent=#2 -\setlength\parsep{0pt plus 1pt}%% -} -\item[] -} -{\end{list}} -\newenvironment{Bullet}[1]%% -{ -\begin{list}{}{%% -\setlength\topsep{0pt}%% -\addtolength{\leftmargin}{#1} -\itemindent=-1em -\setlength\parsep{0pt plus 1pt}%% -} -\item[] -$\txtbullet$\hspace{\enspace} -} -{\end{list}} \usepackage{fancyhdr} -\lhead{} \selectlanguage{%s} \lhead[ ]{ } \chead[ \fancyplain{} \bfseries \footnotesize \leftmark ]{ \fancyplain{} \bfseries \footnotesize \rightmark } \rhead[ ]{ } %s \rfoot[\tiny \href{}{}]{\textrm{\thepage}} -\tolerance=300 -\clubpenalty=300 -\widowpenalty=300 -\makeatother +%% \tolerance=300 +%% \clubpenalty=300 +%% \widowpenalty=300 \makeatother \chardef\txtbullet="2022 \chardef\tilde="7E \def\asterisk{{\rm \char42} } \definecolor{Light}{gray}{.92} +\definecolor{listinggray}{gray}{0.9} +\definecolor{lbcolor}{rgb}{0.9,0.9,0.9} +\lstset{ + backgroundcolor=\color{lbcolor}, + tabsize=4, + rulecolor=, + language=, + basicstyle={\ttfamily\scriptsize}, + upquote=true, + columns=fixed, + showstringspaces=false, + extendedchars=true, + breaklines=true, + prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}}, + frame=single, + showtabs=false, + showspaces=false, + showstringspaces=false, + identifierstyle=\ttfamily, + keywordstyle=\color[rgb]{0,0,1}, + commentstyle=\color[rgb]{0.133,0.545,0.133}, + stringstyle=\color[rgb]{0.627,0.126,0.941}, +} +\DeclareTOCStyleEntry[numwidth+=8pt]{part}{part} +\DeclareTOCStyleEntry[numwidth+=4pt]{section}{section} +\DeclareTOCStyleEntry[numwidth+=3pt]{section}{paragraph} +\DeclareTOCStyleEntry[numwidth+=3pt]{section}{subparagraph} +\DeclareTOCStyleEntry[numwidth+=3pt]{section}{subsection} +\DeclareTOCStyleEntries[indent+=4pt]{section}{section,subsection,subsubsection} +\DeclareTOCStyleEntries[numwidth+=3pt]{section}{paragraph,subparagraph} +\newenvironment{ParagraphIndent}[1]{%% + \begin{list}{}{%% + \setlength\topsep{0pt}%% + \addtolength{\leftmargin}{#1} + \setlength\parsep{0pt plus 1pt}%% + } + \item[] +} {\end{list}} +\newenvironment{ParagraphHang}[2]{%% + \begin{list}{}{%% + \setlength\topsep{0pt}%% + \addtolength{\leftmargin}{#1} + \itemindent=#2 + \setlength\parsep{0pt plus 1pt}%% + } + \item[] +} {\end{list}} +\newenvironment{Bullet}[1]{%% + \begin{list}{}{%% + \setlength\topsep{0pt}%% + \addtolength{\leftmargin}{#1} + \itemindent=-1em + \setlength\parsep{0pt plus 1pt}%% + } + \item[] + $\txtbullet$\hspace{\enspace} +} {\end{list}} \newcommand{\monosp}[1]{\normaltext\ttfamily\texbackslash#1} \newcommand{\br}{\hfill\break} \newcommand{\brl}[1]{%% @@ -1259,19 +1262,19 @@ $\txtbullet$\hspace{\enspace} \fi } \newcommand{\brln}{\hspace*{\fill}\linebreak} -\newcomand{\objBlockOpen}{ +\newcommand{\objBlockOpen}{ \setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}\raggedright \begin{footnotesize} } -\newcomand{\objBlockClose}{%% +\newcommand{\objBlockClose}{%% \end{footnotesize} \setlength{\parskip}{1ex plus0.5ex minus0.2ex} } -\newcomand{\objGroupOpen}{%% +\newcommand{\objGroupOpen}{%% \setlength{\parskip}{0.5ex plus0.2ex minus0.1ex} \begin{footnotesize} } -\newcomand{\objGroupClose}{%% +\newcommand{\objGroupClose}{%% \end{footnotesize} } \newcommand{\objPoemVerseOpen}{%% @@ -1285,12 +1288,13 @@ $\txtbullet$\hspace{\enspace} \setlength{\parskip}{1ex plus0.5ex minus0.2ex} \linebreak } -\newcommand{\parasep}{\smallskip \begin{center}*\hspace{2em}*\hspace{2em}*\end{center} \br} +\newcommand{\parasep}{%% + \smallskip \begin{center}*\hspace{2em}*\hspace{2em}*\end{center} \br +} \newcommand{\spaces}[1]{{\hspace*{#1ex}}} \newcommand{\s}{\hspace*{1ex}} \newcommand{\hardspace}{\hspace*{1ex}} \newcommand{\-}{\hspace*{1ex}} -\newcommand{\..}{\hspace*{1ex}} %% dots trailing \newcommand{\caret}{{\^{~}}} \newcommand{\pipe}{{\textbar}} \newcommand{\curlyOpen}{{} @@ -1300,18 +1304,25 @@ $\txtbullet$\hspace{\enspace} \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{\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{\objCodeBlock}[1]{\normaltext\raggedright\small\ttfamily\texbackslash#1} -\newcommand{\objCodeOpen}{\normaltext\raggedright\small\ttfamily\texbackslash -\begin{lstlisting} +\newcommand{\objCodeOpen}{%% + \normaltext\raggedright\small\ttfamily\texbackslash + \begin{lstlisting} } -\newcommand{\objCodeClose}{ -\end{lstlisting} +\newcommand{\objCodeClose}{%% + \end{lstlisting} } \newcommand{\ocn}[1]{%% \setlength{\parindent}{0em} @@ -1323,61 +1334,40 @@ $\txtbullet$\hspace{\enspace} \hspace{-0.5ex}{\marginpar{\begin{tiny}\hspace{0em}\hypertarget{#1}{#1}\end{tiny}}} \fi } -\newcommand{\ocnhold}[1]{ -\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{#1}{#1}\end{tiny}}} +\newcommand{\ocnhold}[1]{%% + \begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{#1}{#1}\end{tiny}}} } \newcommand{\objCodeBlockHold}[1]{\normaltext\raggedright\small\ttfamily\texbackslash#1} -\definecolor{listinggray}{gray}{0.9} -\definecolor{lbcolor}{rgb}{0.9,0.9,0.9} -\lstset{ - backgroundcolor=\color{lbcolor}, - tabsize=4, - rulecolor=, - language=, - basicstyle={\ttfamily\scriptsize}, - upquote=true, - columns=fixed, - showstringspaces=false, - extendedchars=true, - breaklines=true, - prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}}, - frame=single, - showtabs=false, - showspaces=false, - showstringspaces=false, - identifierstyle=\ttfamily, - keywordstyle=\color[rgb]{0,0,1}, - commentstyle=\color[rgb]{0.133,0.545,0.133}, - stringstyle=\color[rgb]{0.627,0.126,0.941}, -} -\newcommand{\objTableOpen}[1]{ -\setlength{\LTleft}{0pt} -\setlength{\LTright}{\fill} -\begin{tiny} -\begin{longtable}{#1} +\newcommand{\objTableOpen}[1]{%% + \setlength{\LTleft}{0pt} + \setlength{\LTright}{\fill} + \begin{tiny} + \begin{longtable}{#1} } -\newcommand{\objTableClose}{ -\end{longtable} -\end{tiny} +\newcommand{\objTableClose}{%% + \end{longtable} + \end{tiny} } - ┃", - 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.generator_program.project_name.strip, - doc_matters.generator_program.url_home.strip, - paper_size_orientation_latex.strip, - margins.portrait.strip, - multicol.portrait.strip, - lang.codes[doc_matters.src.language]["xlp"], - "english", - 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), - ); +%% \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.generator_program.project_name.strip, + doc_matters.generator_program.url_home.strip, + paper_size_orientation_latex.strip, + margins.portrait.strip, + multicol.portrait.strip, + lang.codes[doc_matters.src.language]["xlp"], + "english", + 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), + ); return _latex_head.strip; } string latex_body(D,M)( diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 5befb23..c9b6fda 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -881,7 +881,7 @@ template docAbstraction() { the_document_blurb_section ~= comp_obj_heading_; tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1to4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; - } else { + } else if (!(line.empty)) { an_object = line.flow_para_match_(an_object, an_object_key, indent, bullet, pith, line_occur); comp_obj_para = comp_obj_para.init; comp_obj_para.metainfo.is_of_part = "backmatter"; -- cgit v1.2.3