From 5689005285fe1871fb6790a54eae07e7492f577a Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Tue, 31 May 2022 17:24:31 +0200 Subject: [PATCH] [scripts] feat: compile luatex + main project if exists --- .local/bin/compiler | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.local/bin/compiler b/.local/bin/compiler index 322a628..e9eeb94 100755 --- a/.local/bin/compiler +++ b/.local/bin/compiler @@ -31,15 +31,21 @@ shebangtest() } texcompile() { \ + [ -e "main.tex" ] && base="main" && file="$base.tex" + cmd="pdflatex" + case "$(head -n 1 $file)" in + *lua*) cmd="lualatex" ;; + esac bibliography="$(grep '\\bibliography' "$file")" + if [ -n "$bibliography" ]; then - pdflatex --output-directory="$dir" "$base" && + $cmd --output-directory="$dir" "$base" && bibtex "$base" && - pdflatex --output-directory="$dir" "$base" && - pdflatex --output-directory="$dir" "$base" + $cmd --output-directory="$dir" "$base" && + $cmd --output-directory="$dir" "$base" else - pdflatex --output-directory="$dir" "$base" && - pdflatex --output-directory="$dir" "$base" + $cmd --output-directory="$dir" "$base" && + $cmd --output-directory="$dir" "$base" fi }