aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-04-10 13:39:46 -0400
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:57:14 +0200
commite081ead4b166207300777716a45fb616a879bdaf (patch)
treede3c9bfc3269e6e6c7056479f8f4e08d51fcb2a4
parentbc7bc188007be1f0bdf8a6f9de9a8bd8303c57c0 (diff)
downloadmuhqs-game-e081ead4b166207300777716a45fb616a879bdaf.tar.gz
muhqs-game-e081ead4b166207300777716a45fb616a879bdaf.zip
use pdflatex and precompiled card headers
This speeds up the compile time for the pdfs dramatically.
-rw-r--r--latex/.gitignore2
-rw-r--r--latex/Makefile15
-rw-r--r--latex/libs.tex8
3 files changed, 22 insertions, 3 deletions
diff --git a/latex/.gitignore b/latex/.gitignore
new file mode 100644
index 00000000..3f554dd2
--- /dev/null
+++ b/latex/.gitignore
@@ -0,0 +1,2 @@
+card.fmt
+card.log
diff --git a/latex/Makefile b/latex/Makefile
index 484aee02..756a498d 100644
--- a/latex/Makefile
+++ b/latex/Makefile
@@ -1,6 +1,6 @@
.DEFAULT_GOAL = all
-PDFLATEX = lualatex
+PDFLATEX ?= pdflatex
PDFTOPPM = pdftoppm
PDFUNITE = pdfunite
@@ -70,6 +70,10 @@ SPECIAL_CARDS_TEX := unit_explanation.tex
SPECIAL_CARDS_PDF := $(foreach card, $(SPECIAL_CARDS_TEX), $(addprefix $(BUILDDIR)/, $(card:.tex=.pdf)))
SPECIAL_CARDS_PNG := $(SPECIAL_CARDS_PDF:.pdf=.png)
+CARDFMT = $(LATEX_ROOT)/card.fmt
+$(CARDFMT): $(COMMON_TEX_FILES)
+ $(PDFLATEX) -ini -jobname="card" "&$(PDFLATEX)" mylatexformat.ltx $(CARDS_TEX_DIR)/base/archer.tex
+
VERBOSE ?= @
MAKEFILE_LIST = Makefile
@@ -119,8 +123,15 @@ $(1)/%.pdf: $(2)%.tex $(COMMON_TEX_FILES) $(MAKEFILE_LIST)
$(VERBOSE) $(PDFLATEX_ENV) $(PDFLATEX) --output-directory $$(@D) $$<
endef
+define generateCardPdfRules
+$(1)/%.pdf: %.tex $(COMMON_TEX_FILES) $(CARDFMT) $(MAKEFILE_LIST)
+ @echo building $$@
+ @if test \( ! \( -d $$(@D) \) \) ;then mkdir -p $$(@D);fi
+ $(VERBOSE) $(PDFLATEX_ENV) $(PDFLATEX) --fmt $(CARDFMT) --output-directory $$(@D) $$<
+endef
+
# Generate cards pdf rules
-$(foreach pdfdir, $(SETS_BUILDDIRS), $(eval $(call generatePdfRules, $(pdfdir),)))
+$(foreach pdfdir, $(SETS_BUILDDIRS), $(eval $(call generateCardPdfRules, $(pdfdir),)))
# Misc cards not in a set
$(eval $(call generatePdfRules, $(BUILDDIR),))
# Generate sets pdf rule
diff --git a/latex/libs.tex b/latex/libs.tex
index fce0651a..facdf3e9 100644
--- a/latex/libs.tex
+++ b/latex/libs.tex
@@ -5,7 +5,13 @@
\usepackage[utf8]{inputenc}
-\usepackage{fontspec}
+\usepackage{iftex}
+% TODO: investigae if we need those
+\ifluatex
+ \usepackage{fontspec}
+\else
+ \usepackage[T1]{fontenc}
+\fi
% optischer Randausgleich
\usepackage{microtype}