From 162ba335083dc1ff97b9481827d85141858c9aca Mon Sep 17 00:00:00 2001
From: Luke Naylor <l.naylor@sms.ed.ac.uk>
Date: Fri, 5 Apr 2024 20:34:37 +0100
Subject: [PATCH] Move aux and output files to separate directories

---
 Makefile  | 6 +++---
 latexmkrc | 3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 6a4988d..ea0b745 100644
--- a/Makefile
+++ b/Makefile
@@ -9,15 +9,15 @@ pretex: rust_tex notebook_py_libs
 
 # Sage artifacts which can only be generated after the first run of (pdf/lua)latex.
 # `make main.sagetex.sout` is invoked by `latexmk -use-make` when needed
-SAGETEXARTIFACT = main.sagetex.sout
+SAGETEXARTIFACT = aux_files/main.sagetex.sout
 # Location for all the python libraries generated from the jupyter notebooks:
 GENERATED_PYLIBS_DIR=generated_py_libs
 
 sage_artifacts: ${SAGETEXARTIFACT}
 
 SAGETEXSCRIPT = main.sagetex.sage # generated by latex compile
-${SAGETEXARTIFACT}: ${SAGETEXSCRIPT} notebook_py_libs
-	PYTHONPATH=./${GENERATED_PYLIBS_DIR} sage ${SAGETEXSCRIPT}
+${SAGETEXARTIFACT}: aux_files/${SAGETEXSCRIPT} notebook_py_libs
+	cd aux_files && PYTHONPATH=../${GENERATED_PYLIBS_DIR} sage ${SAGETEXSCRIPT}
 
 # PYTHON LIBS FROM NOTEBOOKS
 
diff --git a/latexmkrc b/latexmkrc
index 9ea77ca..0a46fa3 100644
--- a/latexmkrc
+++ b/latexmkrc
@@ -2,3 +2,6 @@
 $pdf_mode = 1;
 $pdflatex = 'lualatex -shell-escape -synctex=1 -interaction=nonstopmode';
 @generated_exts = (@generated_exts, 'synctex.gz');
+$use_make_for_missing_files = 1;
+$aux_dir = 'aux_files';
+$out_dir = 'latex_output';
-- 
GitLab