Mise à jour pour hiver 2026

This commit is contained in:
2026-04-07 17:41:35 -03:00
parent 2ce08c4130
commit a14c778394
6 changed files with 411 additions and 158 deletions

View File

@@ -1,28 +1,64 @@
#!/bin/bash
export PATH="/usr/sbin:/usr/bin:$PATH"
SOURCE_DIR=$(pwd)
PARENT_DIR=$(dirname "$SOURCE_DIR")
CHAPTER_NAME=$(basename "$SOURCE_DIR")
run_lualatex() {
local jobname=$1
local texinput=$2
local passes=${3:-2}
for i in 1 2 3; do
lualatex -jobname="$jobname" -shell-escape "$texinput"
local tmpdir=$(mktemp -d)
mkdir -p "$tmpdir/$CHAPTER_NAME"
ln -s "$SOURCE_DIR/main.tex" "$tmpdir/$CHAPTER_NAME/main.tex"
[ -d "$SOURCE_DIR/media" ] && ln -s "$SOURCE_DIR/media" "$tmpdir/$CHAPTER_NAME/media"
[ -d "$SOURCE_DIR/libs" ] && ln -s "$SOURCE_DIR/libs" "$tmpdir/$CHAPTER_NAME/libs"
[ -d "$PARENT_DIR/libs" ] && [ ! -e "$tmpdir/$CHAPTER_NAME/libs" ] && ln -s "$PARENT_DIR/libs" "$tmpdir/$CHAPTER_NAME/libs"
[ -d "$SOURCE_DIR/fonts" ] && ln -s "$SOURCE_DIR/fonts" "$tmpdir/$CHAPTER_NAME/fonts"
[ -d "$PARENT_DIR/fonts" ] && [ ! -e "$tmpdir/$CHAPTER_NAME/fonts" ] && ln -s "$PARENT_DIR/fonts" "$tmpdir/$CHAPTER_NAME/fonts"
cd "$tmpdir/$CHAPTER_NAME"
echo "[START] $jobname"
for ((i=1; i<=passes; i++)); do
lualatex -interaction=nonstopmode -jobname="$jobname" -shell-escape "$texinput" > "$tmpdir/$jobname.log" 2>&1
done
if [ ! -f "$jobname.pdf" ]; then
echo "[ERROR] $jobname failed - no PDF produced"
tail -20 "$tmpdir/$jobname.log" 2>/dev/null
rm -rf "$tmpdir"
return 1
fi
cp "$jobname.pdf" "$SOURCE_DIR/"
echo "[DONE] $jobname"
cd "$SOURCE_DIR"
rm -rf "$tmpdir"
}
clean_env() {
rm -f *.aux *.log *.toc *.out *.lof *.lot *.bbl *.blg *.fls *.fdb_latexmk *.synctex.gz *.nav *.snm
}
run_lualatex "$CHAPTER_NAME" "\PassOptionsToClass{handout}{beamer}\input{main.tex}" 3 &
pid1=$!
run_lualatex "$CHAPTER_NAME-presentation" "main.tex" 3 &
pid2=$!
run_lualatex "$CHAPTER_NAME-print-portrait" "\PassOptionsToClass{handout}{beamer}\def\printportrait{1}\input{main.tex}" 3 &
pid3=$!
run_lualatex "$CHAPTER_NAME-print-landscape" "\PassOptionsToClass{handout}{beamer}\def\printlandscape{1}\input{main.tex}" 3 &
pid4=$!
current_dir=$(basename "$(pwd)")
failed=0
for pid in $pid1 $pid2 $pid3 $pid4; do
wait $pid || failed=1
done
run_lualatex "$current_dir" "\PassOptionsToClass{handout}{beamer}\input{main.tex}"
clean_env
if [ $failed -eq 1 ]; then
echo "Some compilations failed."
exit 1
fi
run_lualatex "$current_dir-presentation" "main.tex"
clean_env
run_lualatex "$current_dir-print-portrait" "\PassOptionsToClass{handout}{beamer}\def\printportrait{1}\input{main.tex}"
clean_env
run_lualatex "$current_dir-print-landscape" "\PassOptionsToClass{handout}{beamer}\def\printlandscape{1}\input{main.tex}"
clean_env
echo "All compilations complete."