Last active
May 17, 2022 04:43
-
-
Save tatumroaquin/2bf1d4e6dc36d4dd477bce1abf3af5d6 to your computer and use it in GitHub Desktop.
compiler script for xelatex documents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
if [ -e "$1" ] ; then | |
file=$(readlink -f "$1") | |
dir=${file%/*} | |
base=${file##*/} | |
name=${base%.*} | |
ext=${file##*.} | |
else | |
name=`basename "$0"` | |
echo "usage: $name <file>" | |
exit | |
fi | |
cd "$dir" || exit | |
case "$ext" in | |
cpp) cc "$file" -o "$base" && "$base" | |
;; | |
tex) xelatex --output-directory="$dir" "$name" && | |
xelatex --output-directory="$dir" "$name" | |
;; | |
: ' | |
WSL2 | |
tex) xelatex.exe "$name" && xelatex.exe "$name" | |
;; | |
' | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment