diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2021-09-09 12:58:16 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2021-09-09 22:52:34 -0400 |
commit | e8d88ac2fc2a05d29d9a24bd42ac3089deadc68b (patch) | |
tree | dc89b36453652971f1573f72ad94109985cffbb3 /org | |
parent | metadata "curate" replaces "harvest" (diff) |
org latex organize
Diffstat (limited to 'org')
-rw-r--r-- | org/config_nix.org | 90 | ||||
-rw-r--r-- | org/out_latex.org | 715 |
2 files changed, 467 insertions, 338 deletions
diff --git a/org/config_nix.org b/org/config_nix.org index 49bb6f8..35feaef 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -331,6 +331,12 @@ $SpineBIN/spine -v --html --html-link-search --html-link-curate --curate --sqlit $SpineBIN/spine -v --cgi-search-form-codegen --config=$SpinePOD/.dr/config_local_site ,#+END_SRC +,*** latex + +,#+BEGIN_SRC sh +$SpineBIN/spine --latex --serial --output="$SpineOUTstatic" $SpinePOD/* +ls $SpineOutstatic/latex/*.tex +,#+END_SRC ' >> nix_note_.org cat nix_note_.org @@ -504,6 +510,7 @@ pkgs.mkShell { <<shell_packages_nix_related>> <<shell_packages_d_build_related>> # <<shell_packages_search_sqlite_related>> + # <<shell_packages_pdf_latex_related>> # <<shell_packages_xml_and_epub_related>> ] )]; @@ -547,6 +554,17 @@ ldc sqlite #+END_SRC +***** packages pdf latex related + +#+NAME: shell_packages_pdf_latex_related +#+BEGIN_SRC nix +# pdf_latex_related +source-sans-pro +source-serif-pro +source-code-pro +texlive.combined.scheme-full +#+END_SRC + ***** packages xml epub related #+NAME: shell_packages_xml_and_epub_related @@ -1269,3 +1287,75 @@ github:nixos/nixpkgs #+BEGIN_SRC nix /nix/var/nix/profiles/per-user/root/channels/nixos #+END_SRC + +** texlive xetex xelatex shell.nix +*** shell.nix :shell: + +#+BEGIN_SRC nix +#!/usr/bin/env -S nix-shell --pure +{ pkgs ? import <nixpkgs> {} }: +pkgs.mkShell { + buildInputs = with pkgs; [ + nixFlakes + nix-prefetch-git + validatePkgConfig + jq + git + fontconfig + source-sans-pro + source-serif-pro + source-code-pro + #(texlive.combine { + # inherit (texlive) scheme-tetex xetex fontspec footmisc multirow titlesec listings anysize float graphics helvetic times courier; + #}) + texlive.combined.scheme-full + dejavu_fonts dejavu_fontsEnv + liberation_ttf + evince + zathura + apvlv + ]; + #FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ + # liberation_ttf + #]; + shellHook = '' + if [[ -e ".envrc" ]]; then + source .envrc + fi + #for texfile in *.tex; do xelatex -interaction=nonstopmode $texfile; done + #for texfile in *.tex; do xelatex -interaction=batchmode $texfile; done + ''; +} +#+END_SRC + +*** notes + +#+BEGIN_SRC sh +nix-shell --run 'which xetex' +echo 'for texfile in *.tex; do echo "* --> " ~ $texfile && xelatex -interaction=batchmode $texfile; rm *.aux *.log *.toc *.out; done' + +$SpineBIN/spine --latex --serial --output="$SpineOUTstatic" $SpinePOD/* && for texfile in $SpineOUTstatic/latex/*.tex; do xelatex -interaction=nonstopmode $texfile; done 2>&1 | tee _err.xelatex_.org; ls $SpineOUTstatic/latex/*.{tex,pdf} + +/run/current-system/sw/share/X11/fonts/ + +kpsewhich pdftexconfig.tex +/nix/store/2r4qa8rbll085nmpx56jg1rbmbir1zkp-texlive-combined-2021/share/texmf/tex/generic/tex-ini-files/pdftexconfig.tex +/nix/store/2r4qa8rbll085nmpx56jg1rbmbir1zkp-texlive-combined-2021/share/texmf/fonts/opentype/public/ + +find: texclive-fonts.conf +fc-cache && mkfontscale && mkfontdir + +fc-match LiberationSans + +cd /nix/var/nix/profiles/system/sw/share/X11/fonts +fc-query LiberationSans-Regular.ttf | grep '^\s\+family:' | cut -d'"' -f2 +Liberation Sans +fc-query LiberationMono-Regular.ttf | grep '^\s\+family:' | cut -d'"' -f2 +Liberation Mono + +fc-query DejaVuSans.ttf | grep '^\s\+family:' | cut -d'"' -f2 + +$XDG_DATA_HOME/fonts +~/.local/share/fonts +#+END_SRC + diff --git a/org/out_latex.org b/org/out_latex.org index 4156071..91ef042 100644 --- a/org/out_latex.org +++ b/org/out_latex.org @@ -33,89 +33,96 @@ template outputLaTeX() { static auto rgx = RgxO(); mixin spineLanguageCodes; auto lang = Lang(); - <<output_latex_shared_a_0>> - <<output_latex_shared_a_1>> - <<output_latex_shared_a_2>> - <<output_latex_shared_a_3>> - <<output_latex_shared_a_4>> - <<output_latex_shared_a_5>> - <<output_latex_shared_a_6>> - <<output_latex_shared_a_7>> - <<output_latex_shared_a_8>> - <<output_latex_shared_a_9>> - <<output_latex_shared_a_10>> - <<output_latex_shared_a_11>> -<<output_latex_shared_b_0>> -<<output_latex_shared_b_1>> -<<output_latex_shared_b_2>> -<<output_latex_shared_b_3>> -<<output_latex_shared_b_4>> -<<output_latex_shared_b_5>> -<<output_latex_shared_b_6>> + <<output_latex_shared_a_paper_type>> + <<output_latex_shared_a_special_characters_to_escape_object>> + <<output_latex_shared_a_special_characters_to_escape_text>> + <<output_latex_shared_a_fontface>> + <<output_latex_shared_a_leading_hardspaces>> + <<output_latex_shared_a_character_nbsp_to_hardspace>> + <<output_latex_shared_a_character_nbsp_to_space>> + <<output_latex_shared_a_links_and_images>> + <<output_latex_shared_a_footnotes>> + <<output_latex_shared_a_footnotes_remove>> + <<output_latex_shared_a_para>> + <<output_latex_shared_a_bookindex>> +<<output_latex_shared_b_heading>> +<<output_latex_shared_b_group>> +<<output_latex_shared_b_block>> +<<output_latex_shared_b_verse>> +<<output_latex_shared_b_codeblock>> +<<output_latex_shared_b_tablarize>> +<<output_latex_shared_b_table>> + <<output_latex_head_bullets_and_indentation>> <<output_latex_head_0>> - <<output_latex_head_1>> - <<output_latex_head_2>> - <<output_latex_head_3>> -<<output_latex_head_b_tex_0>> -<<output_latex_head_b_tex_1>> -<<output_latex_head_b_tex_2>> -<<output_latex_head_b_tex_3>> -<<output_latex_head_b_tex_4>> -<<output_latex_head_b_tex_5>> -<<output_latex_head_b_tex_6>> -<<output_latex_head_b_tex_7>> -<<output_latex_head_b_tex_8>> -<<output_latex_head_b_tex_9>> -<<output_latex_head_b_tex_10>> -<<output_latex_head_b_tex_11>> -<<output_latex_head_b_tex_12>> -<<output_latex_head_b_tex_13>> -<<output_latex_head_b_tex_14>> -<<output_latex_head_b_tex_15>> -<<output_latex_head_b_tex_16>> -<<output_latex_head_b_tex_17>> - <<output_latex_head_b_format_string_variables>> - <<output_latex_head_format_string_0>> - <<output_latex_head_format_string_1>> - <<output_latex_head_format_string_2>> - <<output_latex_head_format_string_3>> -<<output_latex_head_tex_0>> -<<output_latex_head_tex_1>> -<<output_latex_head_tex_2>> -<<output_latex_head_tex_3>> -<<output_latex_head_tex_4>> -<<output_latex_head_tex_5>> -<<output_latex_head_tex_6>> -<<output_latex_head_tex_7>> -<<output_latex_head_tex_8>> -<<output_latex_head_tex_9>> -<<output_latex_head_tex_10>> -<<output_latex_head_tex_11>> -<<output_latex_head_tex_12>> -<<output_latex_head_tex_13>> -<<output_latex_head_tex_14>> + <<output_latex_head_papertype>> + <<output_latex_head_footer>> +<<output_latex_head_b_tex_papermargins>> +<<output_latex_head_b_tex_papermargins_portrait>> +<<output_latex_head_b_tex_papermargins_portrait_set>> +<<output_latex_head_b_tex_papermargins_portrait_close>> +<<output_latex_head_b_tex_papermargins_landscape>> +<<output_latex_head_b_tex_papermargins_landscape_set>> +<<output_latex_head_b_tex_papermargins_landscape_close>> +<<output_latex_head_b_tex_columns_multi>> +<<output_latex_head_b_tex_columns_multi_portrait>> +<<output_latex_head_b_tex_columns_multi_portrait_set>> +<<output_latex_head_b_tex_columns_multi_portrait_close>> +<<output_latex_head_b_tex_columns_multi_landscape>> +<<output_latex_head_b_tex_colorlinks>> +<<output_latex_head_b_tex_colorlinks_mono>> +<<output_latex_head_b_tex_colorlinks_mono_set>> +<<output_latex_head_b_tex_colorlinks_mono_close>> +<<output_latex_head_b_tex_colorlinks_color>> +<<output_latex_head_b_tex_colorlinks_color_set>> +<<output_latex_head_b_tex_colorlinks_color_close>> + <<output_latex_head_format_string_paper_set>> + <<output_latex_head_format_string_paper_set_format_portrait>> +<<output_latex_head_format_string_paper_set_format_portrait_tex>> + <<output_latex_head_format_string_paper_set_format_portrait_variables>> + <<output_latex_head_format_string_paper_set_format_landscape>> +<<output_latex_head_format_string_paper_set_format_landscape_tex>> + <<output_latex_head_format_string_paper_set_format_landscape_variables>> + <<output_latex_head_format_string_paper_set_return>> + <<output_latex_head_format_string_paper_set_orientation>> + <<output_latex_head_format_string_paper_set_color>> + <<output_latex_head_format_tex_set_start_latex_head>> +<<output_latex_head_tex_set_generated_by>> +<<output_latex_head_tex_set_paper_type>> +<<output_latex_head_tex_set_orintation>> +<<output_latex_head_tex_set_margins>> +<<output_latex_head_tex_set_columns>> +<<output_latex_head_tex_set_usepackages_languages_and_font>> +<<output_latex_head_tex_set_usepackages_1>> +<<output_latex_head_tex_set_usepackages_color>> +<<output_latex_head_tex_set_metadata>> +<<output_latex_head_tex_set_colors>> +<<output_latex_head_tex_set_url>> +<<output_latex_head_tex_set_usepackage_misc>> +<<output_latex_head_tex_set_indent_bullet_list>> +<<output_latex_head_tex_set_part_section_subsection_paragraph_subparagraph>> +<<output_latex_head_tex_set_misc>> <<output_latex_head_a_format_string_variables>> <<output_latex_head_close>> - <<output_latex_body_0>> - <<output_latex_body_1>> - <<output_latex_body_2>> - <<output_latex_body_3>> - <<output_latex_body_4>> - <<output_latex_body_5>> - <<output_latex_body_6>> - <<output_latex_tail_0>> - <<output_latex_tail_1>> -<<output_latex_tail_tex>> - <<output_latex_tail_close_0>> - <<output_latex_tail_close_1>> - <<output_latex_0>> - <<output_latex_1>> + <<output_latex_body_function>> + <<output_latex_body_foreach_doc_part>> + <<output_latex_body_for_doc_frontmatter>> + <<output_latex_body_for_doc_body>> + <<output_latex_body_for_doc_backmatter>> + <<output_latex_body_for_doc_default>> + <<output_latex_body_function_return>> + <<output_latex_tail_function>> + <<output_latex_tail_format_string>> +<<output_latex_tail_format_string_tex>> + <<output_latex_tail_format_string_close>> + <<output_latex_tail_function_return>> + <<output_latex_output_write>> + <<output_latex_output_set>> } #+END_SRC ** write latex output :latex:out: -#+NAME: output_latex_0 +#+NAME: output_latex_output_write #+BEGIN_SRC d void writeOutputLaTeX(T,M)( const T latex_content, @@ -157,7 +164,7 @@ void writeOutputLaTeX(T,M)( ** latex output hub [#A] :latex:pdf:out: -#+NAME: output_latex_1 +#+NAME: output_latex_output_set #+BEGIN_SRC d void outputLaTeX(D,M)( const D doc_abstraction, @@ -168,7 +175,7 @@ void outputLaTeX(D,M)( string content; string tail; } - auto latex = LaTeX(); + auto latex = LaTeX(); foreach (paper_size_orientation; doc_matters.conf_make_meta.conf.set_papersize) { latex.head = latex_head(doc_matters, paper_size_orientation); latex.content = latex_body(doc_abstraction, doc_matters, paper_size_orientation); @@ -195,7 +202,7 @@ import doc_reform.io_out; ** shared *** paper dimensions (struct) -#+NAME: output_latex_shared_a_0 +#+NAME: output_latex_shared_a_paper_type #+BEGIN_SRC d auto paper() { struct PaperType { @@ -362,7 +369,7 @@ import doc_reform.io_out; *** latex \escape special characters **** general -#+NAME: output_latex_shared_a_1 +#+NAME: output_latex_shared_a_special_characters_to_escape_object #+BEGIN_SRC d @safe string sp_char_esc(O)( string _txt, @@ -391,7 +398,7 @@ import doc_reform.io_out; } #+END_SRC -#+NAME: output_latex_shared_a_2 +#+NAME: output_latex_shared_a_special_characters_to_escape_text #+BEGIN_SRC d @safe string sp_char_esc_txt()( string _txt, @@ -433,7 +440,7 @@ import doc_reform.io_out; - bold, italics, underscore, strikethrough -#+NAME: output_latex_shared_a_3 +#+NAME: output_latex_shared_a_fontface #+BEGIN_SRC d @safe string fontface()( string _txt, @@ -456,7 +463,7 @@ _txt = _txt **** spaces ***** leading hardspace -#+NAME: output_latex_shared_a_4 +#+NAME: output_latex_shared_a_leading_hardspaces #+BEGIN_SRC d @safe string leading_hardspaces()( string _txt, @@ -473,7 +480,7 @@ _txt = _txt ***** nbsp character -#+NAME: output_latex_shared_a_5 +#+NAME: output_latex_shared_a_character_nbsp_to_hardspace #+BEGIN_SRC d @safe string nbsp_char()(string _txt) { if (_txt.match(rgx.nbsp_char)) { @@ -485,7 +492,7 @@ _txt = _txt ***** remove nbsp character -#+NAME: output_latex_shared_a_6 +#+NAME: output_latex_shared_a_character_nbsp_to_space #+BEGIN_SRC d @safe string nbsp_char_to_space()(string _txt) { if (_txt.match(rgx.nbsp_char)) { @@ -498,7 +505,7 @@ _txt = _txt **** links and images ***** links / urls -#+NAME: output_latex_shared_a_7 +#+NAME: output_latex_shared_a_links_and_images #+BEGIN_SRC d @safe string links_and_images(O,M)( string _txt, @@ -550,7 +557,7 @@ _txt = _txt *** footnotes **** footnotes -#+NAME: output_latex_shared_a_8 +#+NAME: output_latex_shared_a_footnotes #+BEGIN_SRC d @safe string footnotes()( string _txt, @@ -571,7 +578,7 @@ _txt = _txt **** footnote remove -#+NAME: output_latex_shared_a_9 +#+NAME: output_latex_shared_a_footnotes_remove #+BEGIN_SRC d @safe string remove_footnotes()( string _txt, @@ -586,7 +593,7 @@ _txt = _txt *** para **** para -#+NAME: output_latex_shared_a_10 +#+NAME: output_latex_shared_a_para #+BEGIN_SRC d @safe string para(O)( string _txt, @@ -607,7 +614,7 @@ _txt = _txt **** bookindex para -#+NAME: output_latex_shared_a_11 +#+NAME: output_latex_shared_a_bookindex #+BEGIN_SRC d @safe string bookindex(O)( string _txt, @@ -628,7 +635,7 @@ _txt = _txt *** bullets & indentation -#+NAME: output_latex_head_0 +#+NAME: output_latex_head_bullets_and_indentation #+BEGIN_SRC d @safe string bullets_and_indentation(O)( string _txt, @@ -673,7 +680,7 @@ _txt = _txt *** heading -#+NAME: output_latex_shared_b_0 +#+NAME: output_latex_shared_b_heading #+BEGIN_SRC d @safe string heading(O,M)( string _txt, @@ -847,7 +854,7 @@ _txt = _txt - (hardspace not honored) clear hardspace marker -#+NAME: output_latex_shared_b_1 +#+NAME: output_latex_shared_b_group #+BEGIN_SRC d string group(O,M)( string _txt, @@ -875,7 +882,7 @@ string group(O,M)( - (hardspace honored) \hardspace -#+NAME: output_latex_shared_b_2 +#+NAME: output_latex_shared_b_block #+BEGIN_SRC d string block(O,M)( string _txt, @@ -907,7 +914,7 @@ string block(O,M)( - (hardspace honored) \hardspace -#+NAME: output_latex_shared_b_3 +#+NAME: output_latex_shared_b_verse #+BEGIN_SRC d string verse(O,M)( string _txt, @@ -939,7 +946,7 @@ string verse(O,M)( - (hardspace honored) \begin{lstlisting} clear hardspace marker -#+NAME: output_latex_shared_b_4 +#+NAME: output_latex_shared_b_codeblock #+BEGIN_SRC d string codeblock(O,M)( string _txt, @@ -971,7 +978,7 @@ string codeblock(O,M)( ***** tablarize -#+NAME: output_latex_shared_b_5 +#+NAME: output_latex_shared_b_tablarize #+BEGIN_SRC d auto tablarize(O)( string _txt, @@ -1010,7 +1017,7 @@ auto tablarize(O)( ***** table -#+NAME: output_latex_shared_b_6 +#+NAME: output_latex_shared_b_table #+BEGIN_SRC d string table(O,M)( string _txt, @@ -1070,7 +1077,7 @@ string table(O,M)( *** latex head :head: **** latex head function -#+NAME: output_latex_head_1 +#+NAME: output_latex_head_0 #+BEGIN_SRC d string latex_head(M)( M doc_matters, @@ -1082,7 +1089,7 @@ string latex_head(M)( ***** paper type dimensions ****** struct -#+NAME: output_latex_head_2 +#+NAME: output_latex_head_papertype #+BEGIN_SRC d struct paperTypeLatex { string a4_portrait; @@ -1101,7 +1108,7 @@ string latex_head(M)( ****** footer -#+NAME: output_latex_head_3 +#+NAME: output_latex_head_footer #+BEGIN_SRC d string _footer(M)(M doc_matters) { string _ft = "\\lfoot[\\textrm{\\thepage}]"; @@ -1136,7 +1143,7 @@ string latex_head(M)( ***** paper margins ****** struct -#+NAME: output_latex_head_b_tex_0 +#+NAME: output_latex_head_b_tex_papermargins #+BEGIN_SRC d struct paperMargins { string portrait; @@ -1147,19 +1154,19 @@ string latex_head(M)( ****** portrait -#+NAME: output_latex_head_b_tex_1 +#+NAME: output_latex_head_b_tex_papermargins_portrait #+BEGIN_SRC d margins.portrait = format(q"┃ #+END_SRC -#+NAME: output_latex_head_b_tex_2 +#+NAME: output_latex_head_b_tex_papermargins_portrait_set #+BEGIN_SRC latex \setlength{\oddsidemargin}{0mm} \setlength{\evensidemargin}{0mm} \setlength{\topmargin}{-12pt} \setlength{\headheight}{12pt} \setlength{\headsep}{35pt} #+END_SRC -#+NAME: output_latex_head_b_tex_3 +#+NAME: output_latex_head_b_tex_papermargins_portrait_close #+BEGIN_SRC d ┃", ); @@ -1167,19 +1174,19 @@ string latex_head(M)( ****** landscape -#+NAME: output_latex_head_b_tex_4 +#+NAME: output_latex_head_b_tex_papermargins_landscape #+BEGIN_SRC d margins.landscape = format(q"┃ #+END_SRC -#+NAME: output_latex_head_b_tex_5 +#+NAME: output_latex_head_b_tex_papermargins_landscape_set #+BEGIN_SRC latex \setlength{\oddsidemargin}{6mm} \setlength{\evensidemargin}{6mm} \setlength{\topmargin}{-12mm} \setlength{\headheight}{12pt} \setlength{\headsep}{20pt} #+END_SRC -#+NAME: output_latex_head_b_tex_6 +#+NAME: output_latex_head_b_tex_papermargins_landscape_close #+BEGIN_SRC d ┃", ); @@ -1188,7 +1195,7 @@ string latex_head(M)( ***** multicol ****** struct -#+NAME: output_latex_head_b_tex_7 +#+NAME: output_latex_head_b_tex_columns_multi #+BEGIN_SRC d struct columnsMulti { string portrait; @@ -1199,17 +1206,17 @@ string latex_head(M)( ****** portrait -#+NAME: output_latex_head_b_tex_8 +#+NAME: output_latex_head_b_tex_columns_multi_portrait #+BEGIN_SRC d multicol.portrait = format(q"┃ #+END_SRC -#+NAME: output_latex_head_b_tex_9 +#+NAME: output_latex_head_b_tex_columns_multi_portrait_set #+BEGIN_SRC latex \usepackage{multicol} #+END_SRC -#+NAME: output_latex_head_b_tex_10 +#+NAME: output_latex_head_b_tex_columns_multi_portrait_close #+BEGIN_SRC d ┃", ); @@ -1217,7 +1224,7 @@ string latex_head(M)( ****** landscape -#+NAME: output_latex_head_b_tex_11 +#+NAME: output_latex_head_b_tex_columns_multi_landscape #+BEGIN_SRC d multicol.landscape = ""; #+END_SRC @@ -1225,7 +1232,7 @@ string latex_head(M)( ***** color links ****** struct -#+NAME: output_latex_head_b_tex_12 +#+NAME: output_latex_head_b_tex_colorlinks #+BEGIN_SRC d struct colorLinks { string mono; @@ -1236,12 +1243,12 @@ string latex_head(M)( ****** mono -#+NAME: output_latex_head_b_tex_13 +#+NAME: output_latex_head_b_tex_colorlinks_mono #+BEGIN_SRC d links.mono = format(q"┃ #+END_SRC -#+NAME: output_latex_head_b_tex_14 +#+NAME: output_latex_head_b_tex_colorlinks_mono_set #+BEGIN_SRC latex \usepackage[xetex, colorlinks=true, @@ -1250,7 +1257,7 @@ string latex_head(M)( linkcolor=myblack, #+END_SRC -#+NAME: output_latex_head_b_tex_15 +#+NAME: output_latex_head_b_tex_colorlinks_mono_close #+BEGIN_SRC d ┃", ); @@ -1258,12 +1265,12 @@ string latex_head(M)( ****** color -#+NAME: output_latex_head_b_tex_16 +#+NAME: output_latex_head_b_tex_colorlinks_color #+BEGIN_SRC d links.color = format(q"┃ #+END_SRC -#+NAME: output_latex_head_b_tex_17 +#+NAME: output_latex_head_b_tex_colorlinks_color_set #+BEGIN_SRC latex \usepackage[xetex, colorlinks=true, @@ -1272,7 +1279,7 @@ string latex_head(M)( linkcolor=myred, %% \href{...} and \pageref{...} #+END_SRC -#+NAME: output_latex_head_b_format_string_variables +#+NAME: output_latex_head_b_tex_colorlinks_color_close #+BEGIN_SRC d ┃", ); @@ -1282,83 +1289,111 @@ string latex_head(M)( ***** dimensions & orientation ****** set -#+NAME: output_latex_head_format_string_0 +#+NAME: output_latex_head_format_string_paper_set +#+BEGIN_SRC d +string set_paper(P)(P paper_set,) { + string paper_type_description; +#+END_SRC + +#+NAME: output_latex_head_format_string_paper_set_format_portrait +#+BEGIN_SRC d +if (paper_set.is_portrait) { + paper_type_description = format(q"┃ +#+END_SRC + +#+NAME: output_latex_head_format_string_paper_set_format_portrait_tex #+BEGIN_SRC d - 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} \setlength{\textheight}{%s} \setlength{\textwidth}{%s} ┃", - paper_set.font_size, - paper_set.name, - paper_set.height, - paper_set.width, - ); - } else { - paper_type_description = format(q"┃ +#+END_SRC + +#+NAME: output_latex_head_format_string_paper_set_format_portrait_variables +#+BEGIN_SRC d + paper_set.font_size, + paper_set.name, + paper_set.height, + paper_set.width, +); +#+END_SRC + +#+NAME: output_latex_head_format_string_paper_set_format_landscape +#+BEGIN_SRC d +} else { + paper_type_description = format(q"┃ +#+END_SRC + +#+NAME: output_latex_head_format_string_paper_set_format_landscape_tex +#+BEGIN_SRC d \documentclass[%s,%s,landscape,titlepage,twocolumn]{scrartcl} \setlength{\textheight}{%s} \setlength{\textwidth}{%s} ┃", - paper_set.font_size, - paper_set.name, - paper_set.height, - paper_set.width, - ); - } - return paper_type_description; - } #+END_SRC -***** (a4, a5, b4, letter, legal) * (portrait & landscape) +#+NAME: output_latex_head_format_string_paper_set_format_landscape_variables +#+BEGIN_SRC d + paper_set.font_size, + paper_set.name, + paper_set.height, + paper_set.width, +); +#+END_SRC -#+NAME: output_latex_head_format_string_1 -#+BEGIN_SRC d - 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 "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 "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 "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; +#+NAME: output_latex_head_format_string_paper_set_return +#+BEGIN_SRC d } + return paper_type_description; +} +#+END_SRC + +***** (a4, a5, b4, letter, legal) * (portrait & landscape) + +#+NAME: output_latex_head_format_string_paper_set_orientation +#+BEGIN_SRC d +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 "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 "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 "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; +} #+END_SRC ***** set color links -#+NAME: output_latex_head_format_string_2 -#+BEGIN_SRC d - 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.color.strip; - } +#+NAME: output_latex_head_format_string_paper_set_color +#+BEGIN_SRC d +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.color.strip; +} #+END_SRC ***** format latex head, open -#+NAME: output_latex_head_format_string_3 +#+NAME: output_latex_head_format_tex_set_start_latex_head #+BEGIN_SRC d - string _latex_head = format(q"┃%%%% spine LaTeX output +string _latex_head = format(q"┃%%%% spine LaTeX output #+END_SRC ***** description comment -#+NAME: output_latex_head_tex_0 +#+NAME: output_latex_head_tex_set_generated_by #+BEGIN_SRC latex %%%% Generated by: %s %%%% D version: %s @@ -1375,7 +1410,7 @@ string latex_head(M)( - paper_type_latex.us_letter_portrait - paper_type_latex.us_letter_landscape -#+NAME: output_latex_head_tex_1 +#+NAME: output_latex_head_tex_set_paper_type #+BEGIN_SRC latex %s #+END_SRC @@ -1385,14 +1420,14 @@ string latex_head(M)( - margins.portrait - margins.landscape -#+NAME: output_latex_head_tex_2 +#+NAME: output_latex_head_tex_set_orintation #+BEGIN_SRC latex %s #+END_SRC ***** margin shared -#+NAME: output_latex_head_tex_3 +#+NAME: output_latex_head_tex_set_margins #+BEGIN_SRC latex \setlength{\marginparsep}{4mm} \setlength{\marginparwidth}{8mm} @@ -1400,16 +1435,20 @@ string latex_head(M)( ***** multicol (portrait | landscape) -#+NAME: output_latex_head_tex_4 +#+NAME: output_latex_head_tex_set_columns #+BEGIN_SRC latex %s #+END_SRC ***** language & font -#+NAME: output_latex_head_tex_5 +#+NAME: output_latex_head_tex_set_usepackages_languages_and_font #+BEGIN_SRC latex -\usepackage{polyglossia, ucs, fontspec, xltxtra, xunicode} +\usepackage{polyglossia} +\usepackage{ucs} +\usepackage{fontspec} +\usepackage{xltxtra} +\usepackage{xunicode} \setmainlanguage{%s} \setotherlanguage{%s} \setmainfont{Liberation Sans} @@ -1421,7 +1460,7 @@ string latex_head(M)( ***** latex head -#+NAME: output_latex_head_tex_6 +#+NAME: output_latex_head_tex_set_usepackages_1 #+BEGIN_SRC latex \usepackage{alltt} \usepackage{thumbpdf} @@ -1429,14 +1468,14 @@ string latex_head(M)( ***** color links: no = mono | yes = color -#+NAME: output_latex_head_tex_7 +#+NAME: output_latex_head_tex_set_usepackages_color #+BEGIN_SRC latex %s #+END_SRC ***** metadata -#+NAME: output_latex_head_tex_8 +#+NAME: output_latex_head_tex_set_metadata #+BEGIN_SRC latex pdftitle={%s}, pdfauthor={%s}, @@ -1470,7 +1509,7 @@ string latex_head(M)( ***** define colors -#+NAME: output_latex_head_tex_9 +#+NAME: output_latex_head_tex_set_colors #+BEGIN_SRC latex \usepackage[usenames]{color} \definecolor{myblack}{rgb}{0,0,0} @@ -1482,7 +1521,7 @@ string latex_head(M)( ***** latex head -#+NAME: output_latex_head_tex_10 +#+NAME: output_latex_head_tex_set_url #+BEGIN_SRC latex \usepackage{url} \urlstyle{sf} @@ -1492,7 +1531,7 @@ string latex_head(M)( ***** latex head -#+NAME: output_latex_head_tex_11 +#+NAME: output_latex_head_tex_set_usepackage_misc #+BEGIN_SRC latex \usepackage{textcomp} \usepackage[parfill]{parskip} @@ -1514,7 +1553,7 @@ string latex_head(M)( ***** indent, bullet, list -#+NAME: output_latex_head_tex_12 +#+NAME: output_latex_head_tex_set_indent_bullet_list #+BEGIN_SRC latex \usepackage[multiple,ragged]{footmisc} \setlength\footnotemargin{12pt} @@ -1558,7 +1597,7 @@ string latex_head(M)( ***** part, section, subsection, paragraph, subparagraph -#+NAME: output_latex_head_tex_13 +#+NAME: output_latex_head_tex_set_part_section_subsection_paragraph_subparagraph #+BEGIN_SRC latex \usepackage{fancyhdr} \lhead{} @@ -1592,7 +1631,7 @@ string latex_head(M)( ***** latex head misc. including defined commands -#+NAME: output_latex_head_tex_14 +#+NAME: output_latex_head_tex_set_misc #+BEGIN_SRC latex \selectlanguage{%s} \lhead[ ]{ } @@ -1686,7 +1725,7 @@ string latex_head(M)( *** ↻ latex body :content:body: **** latex body function -#+NAME: output_latex_body_0 +#+NAME: output_latex_body_function #+BEGIN_SRC d string latex_body(D,M)( const D doc_abstraction, @@ -1700,166 +1739,166 @@ string latex_body(D,M)( **** ↻ loop open -#+NAME: output_latex_body_1 +#+NAME: output_latex_body_foreach_doc_part #+BEGIN_SRC d - foreach (part; doc_matters.has.keys_seq.latex) { - foreach (obj; doc_abstraction[part]) { - switch (obj.metainfo.is_of_part) { +foreach (part; doc_matters.has.keys_seq.latex) { + foreach (obj; doc_abstraction[part]) { + switch (obj.metainfo.is_of_part) { #+END_SRC **** ↻ within loop ***** frontmatter -#+NAME: output_latex_body_2 -#+BEGIN_SRC d - case "frontmatter": assert(part == "head" || "toc"); - _txt = obj.text - .sp_char_esc(obj) - .fontface; - switch (obj.metainfo.is_of_type) { - case "para": - switch (obj.metainfo.is_a) { - case "heading": - _txt = _txt.heading(obj, doc_matters); - goto default; - case "toc": - break; - default: - _latex_body ~= _txt ~ "\n\n"; - _txt = ""; - break; - } - break; - default: break; - } - break; +#+NAME: output_latex_body_for_doc_frontmatter +#+BEGIN_SRC d +case "frontmatter": assert(part == "head" || "toc"); + _txt = obj.text + .sp_char_esc(obj) + .fontface; + switch (obj.metainfo.is_of_type) { + case "para": + switch (obj.metainfo.is_a) { + case "heading": + _txt = _txt.heading(obj, doc_matters); + goto default; + case "toc": + break; + default: + _latex_body ~= _txt ~ "\n\n"; + _txt = ""; + break; + } + break; + default: break; + } + break; #+END_SRC ***** body -#+NAME: output_latex_body_3 -#+BEGIN_SRC d - case "body": assert(part == "body" || "head"); // surprise - _txt = obj.text - .sp_char_esc(obj) - .fontface; - switch (obj.metainfo.is_of_type) { - case "para": - switch (obj.metainfo.is_a) { - case "heading": - _txt = _txt.heading(obj, doc_matters); - goto default; - case "para": - _txt = _txt.para(obj) - .bullets_and_indentation(obj) - .links_and_images(obj, doc_matters); - goto default; - default: - _latex_body ~= _txt ~ "\n\n"; - _txt = ""; - break; - } - break; - case "block": - switch (obj.metainfo.is_a) { - case "quote": - goto default; // TODO - case "group": - /+ (hardspaces not honored) [remove any hardspace marker] +/ - _txt = _txt.group(obj, doc_matters) - .links_and_images(obj, doc_matters); - goto default; - case "block": - /+ (hardspace honored) \hardspace +/ - _txt = _txt.block(obj, doc_matters) - .links_and_images(obj, doc_matters); - goto default; - case "verse": - /+ (hardspace honored) \hardspace +/ - _txt = _txt.verse(obj, doc_matters) - .links_and_images(obj, doc_matters); - goto default; - case "code": - /+ (hardspace honored) \begin{lstlisting} clear hardspace marker +/ - _txt = _txt.codeblock(obj, doc_matters); - goto default; - case "table": - _txt = _txt.table(obj, doc_matters, paper_size_orientation); - goto default; // TODO - default: - _latex_body ~= _txt ~ "\n\n"; - _txt = ""; - break; - } - break; - default: break; - } - break; +#+NAME: output_latex_body_for_doc_body +#+BEGIN_SRC d +case "body": assert(part == "body" || "head"); // surprise + _txt = obj.text + .sp_char_esc(obj) + .fontface; + switch (obj.metainfo.is_of_type) { + case "para": + switch (obj.metainfo.is_a) { + case "heading": + _txt = _txt.heading(obj, doc_matters); + goto default; + case "para": + _txt = _txt.para(obj) + .bullets_and_indentation(obj) + .links_and_images(obj, doc_matters); + goto default; + default: + _latex_body ~= _txt ~ "\n\n"; + _txt = ""; + break; + } + break; + case "block": + switch (obj.metainfo.is_a) { + case "quote": + goto default; // TODO + case "group": + /+ (hardspaces not honored) [remove any hardspace marker] +/ + _txt = _txt.group(obj, doc_matters) + .links_and_images(obj, doc_matters); + goto default; + case "block": + /+ (hardspace honored) \hardspace +/ + _txt = _txt.block(obj, doc_matters) + .links_and_images(obj, doc_matters); + goto default; + case "verse": + /+ (hardspace honored) \hardspace +/ + _txt = _txt.verse(obj, doc_matters) + .links_and_images(obj, doc_matters); + goto default; + case "code": + /+ (hardspace honored) \begin{lstlisting} clear hardspace marker +/ + _txt = _txt.codeblock(obj, doc_matters); + goto default; + case "table": + _txt = _txt.table(obj, doc_matters, paper_size_orientation); + goto default; // TODO + default: + _latex_body ~= _txt ~ "\n\n"; + _txt = ""; + break; + } + break; + default: break; + } + break; #+END_SRC ***** backmatter -#+NAME: output_latex_body_4 -#+BEGIN_SRC d - case "backmatter": - assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); - _txt = obj.text - .sp_char_esc(obj) - .fontface; - switch (obj.metainfo.is_of_type) { - case "para": - if (part != "bookindex" && _multicolumns) { - _multicolumns = false; - _latex_body ~= "\n\\end{multicols}\n"; - } - switch (obj.metainfo.is_a) { - case "heading": - if (part == "bookindex") { - _multicolumns = true; - } - _txt = _txt.heading(obj, doc_matters, part); - goto default; - case "endnote": assert(part == "endnotes"); - /* uncomment code to reinstate endnotes in endnote section */ - // _txt = _txt.para(obj) - // .bullets_and_indentation(obj) - // .links_and_images(obj, doc_matters); - // goto default; - break; - case "glossary": assert(part == "glossary"); - _txt = _txt.para(obj) - .bullets_and_indentation(obj) - .links_and_images(obj, doc_matters); - goto default; - case "bibliography": assert(part == "bibliography"); - _txt = _txt.para(obj) - .bullets_and_indentation(obj); - goto default; - case "bookindex": assert(part == "bookindex"); - /+ two column, special section +/ - _txt = _txt.bookindex(obj) - .links_and_images(obj, doc_matters); - goto default; - case "blurb": assert(part == "blurb"); - _txt = _txt.para(obj) - .bullets_and_indentation(obj) - .links_and_images(obj, doc_matters); - goto default; - default: - _latex_body ~= (part == "bookindex" && obj.metainfo.is_a != "heading") - ? _txt : (_txt ~ "\n\n"); - _txt = ""; - break; - } - break; - default: break; - } - break; +#+NAME: output_latex_body_for_doc_backmatter +#+BEGIN_SRC d +case "backmatter": + assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail"); + _txt = obj.text + .sp_char_esc(obj) + .fontface; + switch (obj.metainfo.is_of_type) { + case "para": + if (part != "bookindex" && _multicolumns) { + _multicolumns = false; + _latex_body ~= "\n\\end{multicols}\n"; + } + switch (obj.metainfo.is_a) { + case "heading": + if (part == "bookindex") { + _multicolumns = true; + } + _txt = _txt.heading(obj, doc_matters, part); + goto default; + case "endnote": assert(part == "endnotes"); + /* uncomment code to reinstate endnotes in endnote section */ + // _txt = _txt.para(obj) + // .bullets_and_indentation(obj) + // .links_and_images(obj, doc_matters); + // goto default; + break; + case "glossary": assert(part == "glossary"); + _txt = _txt.para(obj) + .bullets_and_indentation(obj) + .links_and_images(obj, doc_matters); + goto default; + case "bibliography": assert(part == "bibliography"); + _txt = _txt.para(obj) + .bullets_and_indentation(obj); + goto default; + case "bookindex": assert(part == "bookindex"); + /+ two column, special section +/ + _txt = _txt.bookindex(obj) + .links_and_images(obj, doc_matters); + goto default; + case "blurb": assert(part == "blurb"); + _txt = _txt.para(obj) + .bullets_and_indentation(obj) + .links_and_images(obj, doc_matters); + goto default; + default: + _latex_body ~= (part == "bookindex" && obj.metainfo.is_a != "heading") + ? _txt : (_txt ~ "\n\n"); + _txt = ""; + break; + } + break; + default: break; + } + break; #+END_SRC ***** after -#+NAME: output_latex_body_5 +#+NAME: output_latex_body_for_doc_default #+BEGIN_SRC d case "comment": break; @@ -1884,7 +1923,7 @@ string latex_body(D,M)( **** latex body return -#+NAME: output_latex_body_6 +#+NAME: output_latex_body_function_return #+BEGIN_SRC d return _latex_body; } @@ -1893,7 +1932,7 @@ string latex_body(D,M)( *** latex tail :tail: **** latex tail function -#+NAME: output_latex_tail_0 +#+NAME: output_latex_tail_function #+BEGIN_SRC d string latex_tail(M)( M doc_matters, @@ -1903,16 +1942,16 @@ string latex_tail(M)( **** latex tail starts -#+NAME: output_latex_tail_1 +#+NAME: output_latex_tail_format_string #+BEGIN_SRC d - string _latex_tail = format(q"┃ +string _latex_tail = format(q"┃ #+END_SRC ***** latex tail format inclusions ***** latex document end -#+NAME: output_latex_tail_tex +#+NAME: output_latex_tail_format_string_tex #+BEGIN_SRC latex \end{document} @@ -1920,7 +1959,7 @@ string latex_tail(M)( **** latex tail format inclusions -#+NAME: output_latex_tail_close_0 +#+NAME: output_latex_tail_format_string_close #+BEGIN_SRC d ┃", // doc_matters.conf_make_meta.meta.title_full, @@ -1930,7 +1969,7 @@ string latex_tail(M)( **** latex tail return -#+NAME: output_latex_tail_close_1 +#+NAME: output_latex_tail_function_return #+BEGIN_SRC d return _latex_tail; } @@ -1939,7 +1978,7 @@ string latex_tail(M)( * latex system command helper script ** latex command, ruby script -#+HEADER: :tangle "../sundry/util/rb/tex/dr_tex.rb" +#+HEADER: :tangle "../sundry/misc/util/rb/tex/dr_tex.rb" #+HEADER: :tangle-mode (identity #o755) #+HEADER: :shebang #!/usr/bin/env ruby #+BEGIN_SRC ruby |