diff options
| author | snailed <luca@snaile.de> | 2022-08-10 11:53:24 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-10 11:53:24 +0000 |
| commit | d92287afe0d055319ad7e3df95732be72d693d09 (patch) | |
| tree | e06b9a2e42aa299d51c740ac611ccacd9b2473ab /.local/bin | |
| parent | 606905268fb71a1c6f3b23ddcaab38886b2f2296 (diff) | |
| download | eibhear-d92287afe0d055319ad7e3df95732be72d693d09.tar.gz eibhear-d92287afe0d055319ad7e3df95732be72d693d09.tar.zst eibhear-d92287afe0d055319ad7e3df95732be72d693d09.zip | |
Parse tex root for more complex latex files
Allows parsing texroot comments so that you can compile a LaTeX document from outside of the document root, as long as it contains the usual magic comment format:
% !TEX root = doc.tex
Diffstat (limited to '.local/bin')
| -rwxr-xr-x | .local/bin/compiler | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/.local/bin/compiler b/.local/bin/compiler index 67992be..85a0c58 100755 --- a/.local/bin/compiler +++ b/.local/bin/compiler @@ -18,6 +18,8 @@ cd "$dir" || exit 1 textype() { \ command="pdflatex" + texroot=$(grep -Poi "^ *% *\! *tex root *= *\w+(?:\.\w*)?" "$file" | cut -d "=" -f 2 | tr -d "[:blank:]") + [ -n "$texroot" ] && base=$texroot && echo "Compiling from TeX root: $texroot" ( head -n5 "$file" | grep -qi 'xelatex' ) && command="xelatex" $command --output-directory="$dir" "$base" && grep -qi addbibresource "$file" && |
