praca_magisterska/scripts/compile_thesis.sh
Copilot e76ac00ad6
Add comprehensive thesis completion game plan, tracking system, automation scripts, and publication-ready LaTeX chapter content with extensive citations (#4)
* Initial plan

* Add comprehensive thesis completion game plan (deadline Feb 10)

Co-authored-by: kuhyx <147418882+kuhyx@users.noreply.github.com>

* Add quick start guide and daily progress tracking template

Co-authored-by: kuhyx <147418882+kuhyx@users.noreply.github.com>

* Add visual tracker and planning system overview

Co-authored-by: kuhyx <147418882+kuhyx@users.noreply.github.com>

* Update work schedule to 4hrs weekdays, 8hrs weekends (144 total hrs)

Co-authored-by: kuhyx <147418882+kuhyx@users.noreply.github.com>

* Update dates to Jan 16-Feb 15, add helper scripts for data collection

Co-authored-by: kuhyx <147418882+kuhyx@users.noreply.github.com>

* Add complete LaTeX content for chapters 5-8, graph generation script, auto-compile script

Co-authored-by: kuhyx <147418882+kuhyx@users.noreply.github.com>

* Add extensive citations throughout chapters, fix Linux-specific issues, replace subjective language with objective data

Co-authored-by: kuhyx <147418882+kuhyx@users.noreply.github.com>

* Fix CI pipeline: use test_pdf instead of test target in workflow

Co-authored-by: kuhyx <147418882+kuhyx@users.noreply.github.com>

* Co-authored-by: kuhyx <147418882+kuhyx@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kuhyx <147418882+kuhyx@users.noreply.github.com>
2026-01-15 17:57:44 +01:00

91 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
# Auto-compile LaTeX thesis script
# Watches for changes and recompiles automatically
THESIS_DIR="/home/runner/work/praca_magisterska/praca_magisterska/latex"
MAIN_FILE="main.tex"
BUILD_DIR="build"
echo "========================================"
echo "LaTeX Thesis Auto-Compiler"
echo "========================================"
echo ""
# Check if we're in the right directory
if [ ! -f "$THESIS_DIR/$MAIN_FILE" ]; then
echo "✗ Error: Cannot find $MAIN_FILE in $THESIS_DIR"
echo " Make sure you're running this from the repository root"
exit 1
fi
cd "$THESIS_DIR" || exit 1
# Function to compile thesis
compile_thesis() {
echo "[$(date +%H:%M:%S)] Compiling thesis..."
# Create build directory if it doesn't exist
mkdir -p "$BUILD_DIR"
# Compile with pdflatex
# First pass
pdflatex -output-directory="$BUILD_DIR" -interaction=nonstopmode "$MAIN_FILE" > /dev/null 2>&1
# Run biber for bibliography
cd "$BUILD_DIR" && biber main > /dev/null 2>&1 && cd ..
# Second pass (for references)
pdflatex -output-directory="$BUILD_DIR" -interaction=nonstopmode "$MAIN_FILE" > /dev/null 2>&1
# Third pass (to be sure)
pdflatex -output-directory="$BUILD_DIR" -interaction=nonstopmode "$MAIN_FILE" > "$BUILD_DIR/last_compile.log" 2>&1
# Check if compilation succeeded
if [ -f "$BUILD_DIR/main.pdf" ]; then
echo "✓ Compilation successful! PDF: $BUILD_DIR/main.pdf"
# Show warnings and errors
grep -i "warning" "$BUILD_DIR/last_compile.log" | head -5
grep -i "error" "$BUILD_DIR/last_compile.log" | head -5
else
echo "✗ Compilation failed. Check $BUILD_DIR/last_compile.log for errors"
tail -20 "$BUILD_DIR/last_compile.log"
fi
echo ""
}
# Check if inotify-tools is installed (for watch mode)
if command -v inotifywait >/dev/null 2>&1; then
echo "Watch mode available. Options:"
echo "1) Compile once and exit"
echo "2) Compile and watch for changes (auto-recompile)"
echo ""
read -p "Select option (1 or 2): " OPTION
if [ "$OPTION" = "2" ]; then
echo "Starting watch mode..."
echo "Monitoring .tex files in $THESIS_DIR for changes"
echo "Press Ctrl+C to stop"
echo ""
# Initial compilation
compile_thesis
# Watch for changes
while true; do
inotifywait -q -e modify -r --include '.*\.tex$' .
echo "[$(date +%H:%M:%S)] Change detected, recompiling..."
compile_thesis
done
else
compile_thesis
fi
else
echo "Note: Install inotify-tools for automatic recompilation on file changes"
echo " sudo apt-get install inotify-tools"
echo ""
compile_thesis
fi
echo "Done!"