diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2017-06-07 02:14:31 +0200 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2017-06-07 02:14:31 +0200 |
| commit | e7b84f8b87da8ea1add3cda9ba3a07cf1f86e7b6 (patch) | |
| tree | f0d2de6986e4fa66ebe90f30a81fcf943c9c7a45 | |
| parent | ff8deaa9ed63e6bd067c45c75966a24f7bfcaab3 (diff) | |
| download | uni-e7b84f8b87da8ea1add3cda9ba3a07cf1f86e7b6.tar uni-e7b84f8b87da8ea1add3cda9ba3a07cf1f86e7b6.tar.gz uni-e7b84f8b87da8ea1add3cda9ba3a07cf1f86e7b6.tar.bz2 uni-e7b84f8b87da8ea1add3cda9ba3a07cf1f86e7b6.tar.xz uni-e7b84f8b87da8ea1add3cda9ba3a07cf1f86e7b6.zip | |
Much more extensive pdf compiling
| -rw-r--r-- | gup/Gupfile | 2 | ||||
| -rwxr-xr-x | gup/pdf.gup | 76 | ||||
| -rw-r--r-- | gup/ps.gup | 7 | ||||
| -rw-r--r-- | preamble.tex | 97 | ||||
| -rw-r--r-- | shell.nix | 3 |
5 files changed, 176 insertions, 9 deletions
diff --git a/gup/Gupfile b/gup/Gupfile index 0478f35..8912143 100644 --- a/gup/Gupfile +++ b/gup/Gupfile | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | pdf.gup: | 1 | pdf.gup: |
| 2 | 2 | ||
| 3 | ps.gup: | ||
| 4 | **/*.ps | ||
| 3 | abgabe.gup: | 5 | abgabe.gup: |
| 4 | **/abgabe.zip | 6 | **/abgabe.zip |
| 5 | manifest.gup: | 7 | manifest.gup: |
diff --git a/gup/pdf.gup b/gup/pdf.gup index 3b3aa3a..96f46ca 100755 --- a/gup/pdf.gup +++ b/gup/pdf.gup | |||
| @@ -1,9 +1,77 @@ | |||
| 1 | #!/usr/bin/env zsh | 1 | #!/usr/bin/env zsh |
| 2 | 2 | ||
| 3 | base=(${2%.pdf}.(md|lhs)([1])) | 3 | ret=0 |
| 4 | 4 | ||
| 5 | gup -u ${base} preamble.tex | 5 | logged() { |
| 6 | printf ">>> ā%sā in %s\n" "$*" $(pwd) >&2 | ||
| 7 | ${@} | ||
| 8 | ret=$? | ||
| 9 | printf ">>> %d\n" $ret >&2 | ||
| 10 | } | ||
| 6 | 11 | ||
| 7 | for i ({0..1}); do | 12 | typeset -a cleanupList |
| 8 | pandoc -t latex -o $1 -V "geometry=margin=2cm" -V "fontfamily=libertine" -H preamble.tex --listings --latex-engine=lualatex ${base} >&2 | 13 | cleanupList=() |
| 14 | cleanup() { | ||
| 15 | for cmd in ${cleanupList}; do | ||
| 16 | eval $cmd | ||
| 17 | done | ||
| 18 | } | ||
| 19 | trap cleanup EXIT | ||
| 20 | |||
| 21 | base=(${2%.pdf}.(md|lhs|tex)([1])) | ||
| 22 | metadata=(${2%.pdf}.meta.yml([1]N)) | ||
| 23 | |||
| 24 | gup -u ${base} ${metadata} preamble.tex | ||
| 25 | |||
| 26 | buildDir=$(pwd) | ||
| 27 | |||
| 28 | base=${base:A} | ||
| 29 | metadata=${metadata:A} | ||
| 30 | cd ${base:h} | ||
| 31 | |||
| 32 | input=${base} | ||
| 33 | |||
| 34 | typeset -a extraArgs | ||
| 35 | extraArgs=(-R -V "geometry=margin=2cm" -V "fontfamily=libertine" -H ${buildDir}/preamble.tex --listings --latex-engine=lualatex --filter=pandoc-citeproc --biblatex) | ||
| 36 | |||
| 37 | |||
| 38 | if [[ -n ${metadata} ]]; then | ||
| 39 | input=$(mktemp) | ||
| 40 | cleanupList+=("rm -v ${input}") | ||
| 41 | |||
| 42 | logged pandoc -f markdown -t native -s ${metadata} | head -n -1 >>${input} | ||
| 43 | logged pandoc -R -t native ${base} >>${input} | ||
| 44 | |||
| 45 | extraArgs+=(-f native) | ||
| 46 | fi | ||
| 47 | |||
| 48 | # logged pandoc ${extraArgs} -t latex ${base} | cat -n >&2 | ||
| 49 | |||
| 50 | compileDir=$(mktemp -d) | ||
| 51 | cleanupList+=("cd /" "rm -rfv ${compileDir}") | ||
| 52 | |||
| 53 | logged pandoc ${extraArgs} -t latex -o ${compileDir}/${base:t:r}.tex ${input} >&2 | ||
| 54 | |||
| 55 | cd ${compileDir} | ||
| 56 | for f (bib); do | ||
| 57 | printf "Checking for ā%sā\n" ${base:h}/${f} >&2 | ||
| 58 | [[ -e ${base:h}/${f} ]] || continue | ||
| 59 | logged rsync -av ${base:h}/${f} . | ||
| 60 | done | ||
| 61 | |||
| 62 | max=5 | ||
| 63 | runs=0 | ||
| 64 | run=true | ||
| 65 | while ${run} && [[ ${runs} -lt ${max} ]]; do | ||
| 66 | output=$(mktemp) | ||
| 67 | cleanupList+=("rm -v ${output}") | ||
| 68 | logged lualatex ${base:t:r}.tex >${output} </dev/null | ||
| 69 | ( return $ret ) || { logged cat ${output}; break } | ||
| 70 | grep -C 2 -i "warning" ${output} | ||
| 71 | run=false | ||
| 72 | grep -Eq $'(\\(re\\)run Biber)|(Please rerun LaTeX)' ${output} && run=true | ||
| 73 | [[ -e ${base:t:r}.bcf && runs -eq 0 ]] && logged biber ${base:t:r} | ||
| 74 | runs=$((runs + 1)) | ||
| 9 | done | 75 | done |
| 76 | |||
| 77 | cp -v ${base:t:r}.pdf $1 | ||
diff --git a/gup/ps.gup b/gup/ps.gup new file mode 100644 index 0000000..f4d158e --- /dev/null +++ b/gup/ps.gup | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | #!/usr/bin/env zsh | ||
| 2 | |||
| 3 | base=${2:r}.pdf | ||
| 4 | |||
| 5 | gup -u ${base} | ||
| 6 | |||
| 7 | pdf2ps ${base} $1 \ No newline at end of file | ||
diff --git a/preamble.tex b/preamble.tex index f0d802c..183313b 100644 --- a/preamble.tex +++ b/preamble.tex | |||
| @@ -6,9 +6,24 @@ | |||
| 6 | \usepackage{bussproofs} | 6 | \usepackage{bussproofs} |
| 7 | \usepackage{tikz} | 7 | \usepackage{tikz} |
| 8 | \usepackage{tikz-qtree,tikz-qtree-compat,circuitikz} | 8 | \usepackage{tikz-qtree,tikz-qtree-compat,circuitikz} |
| 9 | \usepackage{translations} | ||
| 10 | \usepackage{float} | ||
| 11 | \usepackage{csquotes} | ||
| 12 | \usepackage{stmaryrd} | ||
| 13 | \usepackage{cancel} | ||
| 14 | \usepackage{array} | ||
| 9 | 15 | ||
| 10 | \renewcommand{\algorithmicrequire}{\textbf{Input:}} | 16 | \usetikzlibrary{positioning} |
| 11 | \renewcommand{\algorithmicensure}{\textbf{Output:}} | 17 | |
| 18 | \newcolumntype{L}{>{$}l<{$}} | ||
| 19 | \newcolumntype{C}{>{$}c<{$}} | ||
| 20 | |||
| 21 | \DeclareTranslation{English}{float-algorithm}{Algorithm} | ||
| 22 | \DeclareTranslation{German}{float-algorithm}{Algorithmus} | ||
| 23 | |||
| 24 | \floatstyle{ruled} | ||
| 25 | \newfloat{algorithm}{tbp}{lop} | ||
| 26 | \floatname{algorithm}{\GetTranslation{float-algorithm}} | ||
| 12 | 27 | ||
| 13 | \lstset{ | 28 | \lstset{ |
| 14 | frame=tb, | 29 | frame=tb, |
| @@ -30,5 +45,79 @@ keywordstyle= | |||
| 30 | \providecommand{\limplies}{\ensuremath{\Rightarrow}} | 45 | \providecommand{\limplies}{\ensuremath{\Rightarrow}} |
| 31 | \providecommand{\seq}{\ensuremath{\Longrightarrow}} | 46 | \providecommand{\seq}{\ensuremath{\Longrightarrow}} |
| 32 | 47 | ||
| 33 | \theoremstyle{definition} | 48 | \DeclareTranslation{English}{thm-definition}{Definition} |
| 34 | \newtheorem*{def*}{Definition} | 49 | \DeclareTranslation{German}{thm-definition}{Definition} |
| 50 | \DeclareTranslation{English}{thm-theorem}{Theorem} | ||
| 51 | \DeclareTranslation{German}{thm-theorem}{Satz} | ||
| 52 | \DeclareTranslation{English}{thm-example}{Example} | ||
| 53 | \DeclareTranslation{German}{thm-example}{Beispiel} | ||
| 54 | \DeclareTranslation{English}{thm-remark}{Remark} | ||
| 55 | \DeclareTranslation{German}{thm-remark}{Anmerkung} | ||
| 56 | \DeclareTranslation{English}{thm-lemma}{Lemma} | ||
| 57 | \DeclareTranslation{German}{thm-lemma}{Lemma} | ||
| 58 | \DeclareTranslation{English}{thm-proofsketch}{Proof Sketch} | ||
| 59 | \DeclareTranslation{German}{thm-proofsketch}{Beweisskizze} | ||
| 60 | \DeclareTranslation{English}{thm-show}{To show} | ||
| 61 | \DeclareTranslation{German}{thm-show}{Zu Zeigen} | ||
| 62 | |||
| 63 | \makeatletter | ||
| 64 | \newtheoremstyle{definition.indented} | ||
| 65 | {3pt}% space before | ||
| 66 | {3pt}% space after | ||
| 67 | {\addtolength{\@totalleftmargin}{2.5em} | ||
| 68 | \addtolength{\linewidth}{-2.5em} | ||
| 69 | \parshape 1 2.5em \linewidth}% body font | ||
| 70 | {}% indent | ||
| 71 | {\bfseries}% header font | ||
| 72 | {.}% punctuation | ||
| 73 | {.5em}% after theorem header | ||
| 74 | {}% header specification (empty for default) | ||
| 75 | \newtheoremstyle{plain.indented} | ||
| 76 | {3pt}% space before | ||
| 77 | {3pt}% space after | ||
| 78 | {\addtolength{\@totalleftmargin}{2.5em} | ||
| 79 | \addtolength{\linewidth}{-2.5em} | ||
| 80 | \parshape 1 2.5em \linewidth | ||
| 81 | \itshape}% body font | ||
| 82 | {}% indent | ||
| 83 | {\bfseries}% header font | ||
| 84 | {.}% punctuation | ||
| 85 | {.5em}% after theorem header | ||
| 86 | {}% header specification (empty for default) | ||
| 87 | \newtheoremstyle{remark.indented} | ||
| 88 | {3pt}% space before | ||
| 89 | {3pt}% space after | ||
| 90 | {\addtolength{\@totalleftmargin}{2.5em} | ||
| 91 | \addtolength{\linewidth}{-2.5em} | ||
| 92 | \parshape 1 2.5em \linewidth}% body font | ||
| 93 | {}% indent | ||
| 94 | {\itshape}% header font | ||
| 95 | {.}% punctuation | ||
| 96 | {.5em}% after theorem header | ||
| 97 | {}% header specification (empty for default) | ||
| 98 | \makeatother | ||
| 99 | |||
| 100 | \theoremstyle{definition.indented} | ||
| 101 | \newtheorem{defn}{\GetTranslation{thm-definition}} | ||
| 102 | \newtheorem*{defn*}{\GetTranslation{thm-definition}} | ||
| 103 | |||
| 104 | \theoremstyle{plain.indented} | ||
| 105 | \newtheorem{thm}{\GetTranslation{thm-theorem}} | ||
| 106 | \newtheorem*{thm*}{\GetTranslation{thm-theorem}} | ||
| 107 | \newtheorem{lem}[thm]{\GetTranslation{thm-lemma}} | ||
| 108 | \newtheorem*{lem*}{\GetTranslation{thm-lemma}} | ||
| 109 | |||
| 110 | \theoremstyle{remark.indented} | ||
| 111 | \newtheorem{rem}{\GetTranslation{thm-remark}} | ||
| 112 | \newtheorem*{rem*}{\GetTranslation{thm-remark}} | ||
| 113 | \newtheorem{eg}[rem]{\GetTranslation{thm-example}} | ||
| 114 | \newtheorem*{eg*}{\GetTranslation{thm-example}} | ||
| 115 | \newtheorem*{sketch}{\GetTranslation{thm-proofsketch}} | ||
| 116 | \newtheorem*{tshow}{\GetTranslation{thm-show}} | ||
| 117 | |||
| 118 | \newcommand\restr[2]{{% we make the whole thing an ordinary symbol | ||
| 119 | \left.\kern-\nulldelimiterspace % automatically resize the bar with \right | ||
| 120 | #1 % the function | ||
| 121 | \vphantom{\big|} % pretend it's a little taller at normal size | ||
| 122 | \right|_{#2} % this is the delimiter | ||
| 123 | }} | ||
| @@ -11,9 +11,10 @@ pkgs.stdenv.mkDerivation rec { | |||
| 11 | (pkgs.callPackage ./mars.nix {}) | 11 | (pkgs.callPackage ./mars.nix {}) |
| 12 | pkgs.sqlite | 12 | pkgs.sqlite |
| 13 | (pkgs.haskellPackages.ghcWithPackages (p: | 13 | (pkgs.haskellPackages.ghcWithPackages (p: |
| 14 | with p; [ yesod yesod-bin pandoc monad-par persistent-sqlite containers base-unicode-symbols containers-unicode-symbols | 14 | with p; [ yesod yesod-bin pandoc pandoc-citeproc monad-par persistent-sqlite containers base-unicode-symbols containers-unicode-symbols |
| 15 | ])) | 15 | ])) |
| 16 | pkgs.texlive.combined.scheme-full | 16 | pkgs.texlive.combined.scheme-full |
| 17 | pkgs.biber | ||
| 17 | ]; | 18 | ]; |
| 18 | shellHook = '' | 19 | shellHook = '' |
| 19 | export PROMPT_INFO="${name}" | 20 | export PROMPT_INFO="${name}" |
