Skip to content

Instantly share code, notes, and snippets.

@tatumroaquin
Last active May 17, 2022 04:43
Show Gist options
  • Save tatumroaquin/2bf1d4e6dc36d4dd477bce1abf3af5d6 to your computer and use it in GitHub Desktop.
Save tatumroaquin/2bf1d4e6dc36d4dd477bce1abf3af5d6 to your computer and use it in GitHub Desktop.
compiler script for xelatex documents
#!/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