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

@@ -1,8 +1,9 @@
#!/usr/bin/make #!/usr/bin/make
# fonts.tex is a fragment meant to be \input, not a document of its own, so it # fonts.tex and notes-preamble.tex are fragments meant to be \input, not
# has to stay out of the list or make will try to typeset it. # documents of their own, so they stay out of the list or make would try to
TEX := $(filter-out fonts.tex,$(wildcard *.tex)) # typeset them.
TEX := $(filter-out fonts.tex notes-preamble.tex,$(wildcard *.tex))
PDF := $(patsubst %.tex,%.pdf,$(TEX)) PDF := $(patsubst %.tex,%.pdf,$(TEX))
JOB := $(patsubst %.tex,%,$(TEX)) JOB := $(patsubst %.tex,%,$(TEX))

View File

@@ -69,8 +69,10 @@ from. Show it with [dspdfviewer](https://github.com/dannyedel/dspdfviewer),
[backstage](https://bckstg.xyz/). [backstage](https://bckstg.xyz/).
To use notes in another ltx-talk document, copy `mknotes` and `talk-notes.sty` To use notes in another ltx-talk document, copy `mknotes` and `talk-notes.sty`
across and load the package. `mknotes` picks up `fonts.tex` when it is present, across and load the package. `mknotes` picks up `notes-preamble.tex`,
so the notes match the deck; `--preamble FILE` names a different fragment. or else `fonts.tex`, when present, so the notes match the deck; a deck whose
notes use its own macros defines them in `notes-preamble.tex` (starting with
`\input{fonts.tex}`). `--preamble FILE` names a different fragment.
## Theme ## Theme

View File

@@ -158,6 +158,10 @@ HMARGIN = 0.06
#: Font setup shared with the slides. Used when it exists, so that the notes #: Font setup shared with the slides. Used when it exists, so that the notes
#: match the deck without anyone having to remember a flag. #: 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" DEFAULT_PREAMBLE = "fonts.tex"
# The page is laid out by hand rather than by geometry: the header band runs # 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 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. # a convenience and is skipped when the document does not use it.
preamble = args.preamble preamble = args.preamble
if preamble and not os.path.exists(preamble): if preamble == DEFAULT_PREAMBLE:
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") raise SystemExit(f"mknotes: {preamble} not found")
preamble = None
workdir = tempfile.mkdtemp(prefix="mknotes-") workdir = tempfile.mkdtemp(prefix="mknotes-")
try: try: