20
0

Let decks define note macros in notes-preamble.tex

Notes that use a deck's own macros failed to typeset, since mknotes
only pulled in fonts.tex. A deck now defines them in notes-preamble.tex
(starting with \input{fonts.tex}), which mknotes prefers when present.
The Makefile keeps the new fragment out of the document list.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-20 00:11:19 +09:00
parent ab50e8e025
commit b7e37320de
3 changed files with 16 additions and 9 deletions

View File

@@ -158,6 +158,10 @@ HMARGIN = 0.06
#: Font setup shared with the slides. Used when it exists, so that the notes
#: match the deck without anyone having to remember a flag.
# notes-preamble.tex wins when present: a deck whose notes use its own macros
# defines them there (\input{fonts.tex} included), keeping fonts.tex a pure
# font fragment shared with the slides.
DEFAULT_PREAMBLES = ("notes-preamble.tex", "fonts.tex")
DEFAULT_PREAMBLE = "fonts.tex"
# The page is laid out by hand rather than by geometry: the header band runs
@@ -360,10 +364,10 @@ def main():
# A preamble named on the command line has to be there; the default one is
# a convenience and is skipped when the document does not use it.
preamble = args.preamble
if preamble and not os.path.exists(preamble):
if preamble != DEFAULT_PREAMBLE:
raise SystemExit(f"mknotes: {preamble} not found")
preamble = None
if preamble == DEFAULT_PREAMBLE:
preamble = next((p for p in DEFAULT_PREAMBLES if os.path.exists(p)), None)
elif preamble and not os.path.exists(preamble):
raise SystemExit(f"mknotes: {preamble} not found")
workdir = tempfile.mkdtemp(prefix="mknotes-")
try: