diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rwxr-xr-x | gup/pdf.gup | 34 | ||||
-rw-r--r-- | preamble.tex | 1 | ||||
-rw-r--r-- | shell.nix | 16 |
4 files changed, 37 insertions, 18 deletions
@@ -8,3 +8,7 @@ | |||
8 | **/*.o | 8 | **/*.o |
9 | /ws2015/ffp/blaetter/12/demo.sqlite | 9 | /ws2015/ffp/blaetter/12/demo.sqlite |
10 | .shell.drv | 10 | .shell.drv |
11 | /bachelor-thesis/literature.meta.yml | ||
12 | /bachelor-thesis/literature.pdf | ||
13 | /ss2016/**/*.pdf | ||
14 | /ss2017/**/*.pdf | ||
diff --git a/gup/pdf.gup b/gup/pdf.gup index d0ebac5..31515af 100755 --- a/gup/pdf.gup +++ b/gup/pdf.gup | |||
@@ -28,7 +28,11 @@ if [[ $beamerAspects[(i)${2:r:e}] -le $#beamerAspects ]]; then | |||
28 | fi | 28 | fi |
29 | 29 | ||
30 | base=(${2:r}.(md|lhs|tex)([1])) | 30 | base=(${2:r}.(md|lhs|tex)([1])) |
31 | metadata=(${2:r}.meta.yml([1]N)) | 31 | metadata=${2:r}.meta.yml |
32 | |||
33 | if ! [[ -e ${metadata} ]] && ! gup --buildable ${metadata}; then | ||
34 | metadata="" | ||
35 | fi | ||
32 | 36 | ||
33 | gup -u ${base} ${metadata} preamble.tex | 37 | gup -u ${base} ${metadata} preamble.tex |
34 | 38 | ||
@@ -41,9 +45,13 @@ cd ${base:h} | |||
41 | input=${base} | 45 | input=${base} |
42 | 46 | ||
43 | typeset -a extraArgs | 47 | typeset -a extraArgs |
44 | extraArgs=(-R -V "geometry=margin=2cm" -V "fontfamily=libertine" -H ${buildDir}/preamble.tex --listings --latex-engine=lualatex --filter=pandoc-citeproc --biblatex) | 48 | extraArgs=(-R -V "geometry=margin=2cm" -V "fontfamily=libertine" -H ${buildDir}/preamble.tex --listings --latex-engine=lualatex --biblatex) |
49 | #extraArgs+=(--filter=pandoc-citeproc) | ||
45 | 50 | ||
46 | 51 | ||
52 | compileDir=$(mktemp -d) | ||
53 | cleanupList+=("cd /" "rm -rfv ${compileDir}") | ||
54 | |||
47 | if [[ -n ${metadata} ]]; then | 55 | if [[ -n ${metadata} ]]; then |
48 | input=$(mktemp) | 56 | input=$(mktemp) |
49 | cleanupList+=("rm -v ${input}") | 57 | cleanupList+=("rm -v ${input}") |
@@ -56,10 +64,19 @@ if [[ -n ${metadata} ]]; then | |||
56 | logged pandoc -R ${class} -t native ${base} >>${input} | 64 | logged pandoc -R ${class} -t native ${base} >>${input} |
57 | 65 | ||
58 | extraArgs+=(-f native) | 66 | extraArgs+=(-f native) |
59 | fi | ||
60 | 67 | ||
61 | compileDir=$(mktemp -d) | 68 | |
62 | cleanupList+=("cd /" "rm -rfv ${compileDir}") | 69 | bibFiles=$(pandoc -f markdown -t json -s ${metadata} | jq -r '.meta.bibliography.c[] | (.c[0].c)? // .c') |
70 | |||
71 | gup -u ${(f)bibFiles} | ||
72 | |||
73 | for bibFile (${(f)bibFiles}); do | ||
74 | targetPath=${compileDir}/$(realpath --relative-to=${base:h} -- ${base:h}/${bibFile:h}) | ||
75 | |||
76 | [[ ! -e ${targetPath} ]] && logged mkdir -p ${targetPath} | ||
77 | logged cp ${bibFile} ${targetPath}/${bibFile:t} | ||
78 | done | ||
79 | fi | ||
63 | 80 | ||
64 | if [[ ${base:t:r} == "presentation" ]]; then | 81 | if [[ ${base:t:r} == "presentation" ]]; then |
65 | gup -u ${buildDir}/beamer-template.tex | 82 | gup -u ${buildDir}/beamer-template.tex |
@@ -70,15 +87,10 @@ fi | |||
70 | logged pandoc ${extraArgs} -o ${compileDir}/${base:t:r}.tex ${input} >&2 | 87 | logged pandoc ${extraArgs} -o ${compileDir}/${base:t:r}.tex ${input} >&2 |
71 | 88 | ||
72 | cd ${compileDir} | 89 | cd ${compileDir} |
73 | for f (bib); do | ||
74 | printf "Checking for ā%sā\n" ${base:h}/${f} >&2 | ||
75 | [[ -e ${base:h}/${f} ]] || continue | ||
76 | logged rsync -av ${base:h}/${f} . | ||
77 | done | ||
78 | 90 | ||
79 | # cat -n ${base:t:r}.tex >&2 | 91 | # cat -n ${base:t:r}.tex >&2 |
80 | 92 | ||
81 | max=5 | 93 | max=10 |
82 | runs=0 | 94 | runs=0 |
83 | run=true | 95 | run=true |
84 | while ${run} && [[ ${runs} -lt ${max} ]]; do | 96 | while ${run} && [[ ${runs} -lt ${max} ]]; do |
diff --git a/preamble.tex b/preamble.tex index 369abf6..5f1fe95 100644 --- a/preamble.tex +++ b/preamble.tex | |||
@@ -12,6 +12,7 @@ | |||
12 | \usepackage{stmaryrd} | 12 | \usepackage{stmaryrd} |
13 | \usepackage{cancel} | 13 | \usepackage{cancel} |
14 | \usepackage{array} | 14 | \usepackage{array} |
15 | \usepackage{xfrac} | ||
15 | 16 | ||
16 | \usetikzlibrary{positioning} | 17 | \usetikzlibrary{positioning} |
17 | 18 | ||
@@ -6,15 +6,17 @@ pkgs.stdenv.mkDerivation rec { | |||
6 | buildInputs = [ pkgs.gup | 6 | buildInputs = [ pkgs.gup |
7 | pkgs.jdk | 7 | pkgs.jdk |
8 | pkgs.zip | 8 | pkgs.zip |
9 | pkgs.strace | 9 | # pkgs.strace |
10 | pkgs.gcc | 10 | # pkgs.gcc |
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 pandoc-citeproc monad-par persistent-sqlite containers base-unicode-symbols containers-unicode-symbols | 14 | with p; [ pandoc pandoc-citeproc |
15 | ])) | 15 | # yesod yesod-bin monad-par persistent-sqlite containers base-unicode-symbols containers-unicode-symbols |
16 | ])) | ||
16 | pkgs.texlive.combined.scheme-full | 17 | pkgs.texlive.combined.scheme-full |
17 | pkgs.biber | 18 | pkgs.biber |
19 | pkgs.pdfpc | ||
18 | ]; | 20 | ]; |
19 | shellHook = '' | 21 | shellHook = '' |
20 | export PROMPT_INFO="${name}" | 22 | export PROMPT_INFO="${name}" |