diff options
| author | Luke Smith <luke@lukesmith.xyz> | 2018-07-24 13:34:38 -0400 |
|---|---|---|
| committer | Luke Smith <luke@lukesmith.xyz> | 2018-07-24 13:34:38 -0400 |
| commit | 56c4fbe952aab9d62ba2aa00557fc7edabc0bd93 (patch) | |
| tree | 7fd1bbbf7fb7a4a41a2e27674af420def4d36419 /.scripts/compiler | |
| parent | f18db3d84a2f735513bbdd4376d7221b1662fa67 (diff) | |
| download | eibhear-56c4fbe952aab9d62ba2aa00557fc7edabc0bd93.tar.gz eibhear-56c4fbe952aab9d62ba2aa00557fc7edabc0bd93.tar.zst eibhear-56c4fbe952aab9d62ba2aa00557fc7edabc0bd93.zip | |
handles tex bibs and absolute location
Diffstat (limited to '.scripts/compiler')
| -rwxr-xr-x | .scripts/compiler | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/.scripts/compiler b/.scripts/compiler index 7a24a35..ca7455d 100755 --- a/.scripts/compiler +++ b/.scripts/compiler @@ -4,14 +4,28 @@ # # It compiles a document to pdf -file=$(basename "$1") +file=$(readlink -f "$1") ext="${file##*.}" base="${file%.*}" -echo $ext +textype() { [ grep -i addbibresource "$file" ] && bib=1 + +if sed 5q "$file" | grep -i -q 'xelatex' > /dev/null 2>&1; then + [ -z ${bib+x} ] || (xelatex "$base" && break) + xelatex "$base" && + biber "$base" && + xelatex "$base" && + xelatex "$base" +else + [ -z ${bib+x} ] || (pdflatex "$base" && break) + pdflatex "$base" && + biber "$base" && + pdflatex "$base" && + pdflatex "$base" +fi ;} case "$ext" in rmd) echo "require(rmarkdown); render('$file')" | R --vanilla ;; - tex) xelatex "$file" ;; + tex) textype "$file" ;; md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;; esac |
