Created
December 2, 2019 20:39
-
-
Save sbrki/f68c9a4d18cd5318109ffe1cb667671e to your computer and use it in GitHub Desktop.
Simple bash script for compiling and live previewing LaTeX
This file contains 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
#!/bin/bash | |
if [ $# -eq 0 ] | |
then | |
echo "No tex file provided" | |
echo "Usage: ./autotex.sh file.tex" | |
exit | |
fi | |
zathura $(echo $1 | sed "s/tex/pdf/") & # run the pdf viewer | |
inotifywait -m -e close_write $1 | # listen for file events | |
while read -r filename event; do | |
pdflatex --halt-on-error $1 # compile pdf | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment