LaTeX_Files/resume/build.sh
WanderingPenwing d581712fd5 initial commit
2024-10-16 16:48:20 +02:00

37 lines
743 B
Bash
Executable file

#!/usr/bin/env bash
OUTPUT_DIR=".out"
FILE="main"
compile_latex() {
mkdir -p "$OUTPUT_DIR" # if does not exist
rm -rf "$OUTPUT_DIR/*" # if exist and full
rsync -av --exclude="$OUTPUT_DIR" ./ "$OUTPUT_DIR" > /dev/null 2>&1
cd "$OUTPUT_DIR" || exit
if ! pdflatex --interaction=nonstopmode "$FILE.tex" > error.log 2>&1; then
echo "Compilation failed. Check error.log for details."
else
echo "Compilation successful."
rm error.log
fi
cd .. || exit
}
compile_latex
zathura "$OUTPUT_DIR/$FILE.pdf" &
while true; do
inotifywait -e modify -e create -e delete -r . --include '.*\.tex' > /dev/null 2>&1
echo "Change detected. Compiling LaTeX files..."
compile_latex
done