# Makefile for SIAM Article Template with PythonTeX # Optimized for CoCalc LaTeX environment # Main document MAIN = main TEX_FILE = $(MAIN).tex PDF_FILE = $(MAIN).pdf # LaTeX compiler settings LATEX = pdflatex LATEXFLAGS = -shell-escape -interaction=nonstopmode -file-line-error # Bibliography processor BIBTEX = bibtex # PythonTeX processor PYTHONTEX = pythontex # Default target all: $(PDF_FILE) # Full build with PythonTeX $(PDF_FILE): $(TEX_FILE) @echo "Building SIAM article with PythonTeX..." $(LATEX) $(LATEXFLAGS) $(MAIN) $(PYTHONTEX) $(MAIN) $(LATEX) $(LATEXFLAGS) $(MAIN) $(LATEX) $(LATEXFLAGS) $(MAIN) @echo "Build complete: $(PDF_FILE)" # Quick build without PythonTeX (for drafts) draft: $(TEX_FILE) @echo "Quick draft build..." $(LATEX) $(LATEXFLAGS) $(MAIN) # Clean auxiliary files clean: rm -f *.aux *.log *.bbl *.blg *.toc *.out *.nav *.snm rm -f *.fdb_latexmk *.fls *.synctex.gz rm -f *.pytxcode *.figpytx *.makepytx *.figpytx *.pytxpyg rm -f *.pytxmcr *.pytxpyg rm -f pythontex-files-$(MAIN)/* rm -rf pythontex-files-$(MAIN)/ rm -f *.png *.pdf.figpytx # Deep clean including PDF distclean: clean rm -f $(PDF_FILE) # Watch for changes (requires inotify-tools) watch: @echo "Watching for changes to $(TEX_FILE)..." while inotifywait -e modify $(TEX_FILE); do make; done # Continuous build for development dev: @echo "Development mode - building on changes..." @make @make watch # Install missing packages (CoCalc specific) install-deps: @echo "Installing/updating LaTeX packages for SIAM template..." @echo "Note: In CoCalc, most packages are pre-installed" @echo "If you encounter missing packages, contact CoCalc support" # Spell check (if aspell is available) spell: @if command -v aspell >/dev/null 2>&1; then \ aspell -t -c $(TEX_FILE); \ else \ echo "aspell not available for spell checking"; \ fi # Count words (approximate) wordcount: @echo "Approximate word count:" @texcount -total -brief $(TEX_FILE) # Show compilation info info: @echo "SIAM LaTeX Template Information:" @echo " Main file: $(TEX_FILE)" @echo " Output: $(PDF_FILE)" @echo " Compiler: $(LATEX) with flags: $(LATEXFLAGS)" @echo " PythonTeX: $(PYTHONTEX)" @echo "" @echo "Available targets:" @echo " all - Full build with PythonTeX (default)" @echo " draft - Quick build without PythonTeX" @echo " clean - Remove auxiliary files" @echo " distclean - Remove all generated files" @echo " watch - Watch for file changes and rebuild" @echo " dev - Development mode (build + watch)" @echo " spell - Spell check (if aspell available)" @echo " wordcount - Count words in document" @echo " info - Show this information" # Help target help: info .PHONY: all draft clean distclean watch dev install-deps spell wordcount info help