Created
June 24, 2024 20:51
-
-
Save brunobmello25/6f930da76ef05fa8442e9bb4ed575955 to your computer and use it in GitHub Desktop.
bash script to auto recompile latex file when changes happen
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
| # please install dependencies first: | |
| # sudo apt update && sudo apt install textlive-full inotify-tools | |
| # | |
| # USAGE: ./run.sh ./tex-directory/texfile.tex | |
| # ------------------------------------------------------------- | |
| #!/bin/bash | |
| FILE=$1 | |
| DIR=$(dirname "$FILE") | |
| BASENAME=$(basename "$FILE" .tex) | |
| inotifywait -m -e close_write "$DIR" | | |
| while read -r directory events filename; do | |
| if [ "$filename" == "$BASENAME.tex" ]; then | |
| pdflatex -interaction=nonstopmode -synctex=1 -output-directory="$DIR" "$FILE" | |
| fi | |
| done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment