From 78e21b0e1f2c7dbdff24cdcf7f30c0fbfe5084cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C5=A1o=20=C5=BDivanovi=C4=87?= Date: Sun, 24 Nov 2024 14:37:30 +0100 Subject: [PATCH] Building examples: inform make about *all* dependencies. --- INSTALL.md | 2 +- Makefile | 11 +- doc/.gitignore | 4 +- doc/examples/Makefile | 591 ++++++++++-------- .../{_auto-ref.tex.dtx => auto-ref.tex.dtx} | 0 doc/examples/chained-advice.tex.dtx | 7 +- ...x => collargs-ignore-nesting-true.tex.dtx} | 0 ...dtx => collargs-ignore-other-tags.tex.dtx} | 0 doc/examples/extract-excerpts.pl | 1 + doc/examples/poormansbox-driver.tex.dtx | 44 -- doc/examples/poormansbox-memoizable.tex.dtx | 44 -- doc/memoize-doc.sty | 38 +- doc/memoize-doc.tex | 69 +- 13 files changed, 393 insertions(+), 418 deletions(-) rename doc/examples/{_auto-ref.tex.dtx => auto-ref.tex.dtx} (100%) rename doc/examples/{_collargs-verbatim.tex.dtx => collargs-ignore-nesting-true.tex.dtx} (100%) rename doc/examples/{_collargs-ignore-other-tags.tex.dtx => collargs-ignore-other-tags.tex.dtx} (100%) delete mode 100644 doc/examples/poormansbox-driver.tex.dtx delete mode 100644 doc/examples/poormansbox-memoizable.tex.dtx diff --git a/INSTALL.md b/INSTALL.md index b72dc99..483e9d0 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -29,7 +29,7 @@ Note that installation from the sources and compilation of the documentation require a UNIX-like operating system (Windows Subsystem for Linux suffices) with `make` and several other programs installed. In detail, Memoize's build system utilizes standard utilities `make`, `bash`, `sed`, `grep`, `perl`, -`pandoc` and `zip`, plus the TeX-specific `latexmk` and `edtx2dtx`, which +`pandoc`, `xargs`, `zip`, plus the TeX-specific `latexmk` and `edtx2dtx`, which should be included in your TeX distribution. ## For the impatient diff --git a/Makefile b/Makefile index 42cdfe2..9c796a2 100644 --- a/Makefile +++ b/Makefile @@ -60,18 +60,11 @@ pdf := $(PDF:%=doc/%) DOC = $(codedoc-source) $(manual-source) $(pdf) $(man-src) \ doc/examples-src.zip doc/examples.zip -examples-src := Makefile ins.begin ins.mid ins.end -examples-src := $(examples-src:%=doc/examples/%) -#examples-src += $(shell git ls-files | grep ^doc/examples/.*dtx$) -examples-src += $(shell find doc/examples -name '*.dtx') - doc/examples-src.zip: $(examples-src) - cd doc && zip examples-src.zip $(examples-src:doc/%=%) + $(MAKE) -C doc/examples examples-src.zip doc/examples.zip: $(examples-src) - mkdir -p doc/examples/attachments - $(MAKE) -C doc/examples - cd doc/examples/attachments && zip -r ../../examples.zip * + $(MAKE) -C doc/examples examples.zip ctan/$(PACKAGE).zip: $(TDS-BEGIN) diff --git a/doc/.gitignore b/doc/.gitignore index 3e4f8e6..d7a847e 100644 --- a/doc/.gitignore +++ b/doc/.gitignore @@ -1,5 +1,5 @@ *.listing.attachment -latexmkrc _fn.tex -attachments.lst *idx.orig +examples.zip +examples-src.zip diff --git a/doc/examples/Makefile b/doc/examples/Makefile index 71c434e..fd9ddcf 100644 --- a/doc/examples/Makefile +++ b/doc/examples/Makefile @@ -1,8 +1,9 @@ SHELL := /bin/bash -.PHONY: clean all excerpts +.PHONY: clean all .SECONDARY: .DEFAULT_GOAL := all +# todo: compare to the list of used .dtxs clean: find . \( \( -type f -not \( \ -name '*.dtx' -or -name 'ins.*' -or -name .gitignore -or \ @@ -10,34 +11,154 @@ clean: -name get-filename-from-mmz.tex \ \) \) -or \( -type d -name '*.memo.dir' \) \) -print -delete -N = 0 - -%.pdf: %.tex - touch $*.mmz ; memoize-clean.py --all --yes $*.mmz - rm -f $*.mmz - latexmk -C $* - if [[ $(N) > 0 ]] ; then \ - for ((n=1;$$n<=$(N);n++)) ; do \ - cp $*.tex.c$$n $*.tex ; $(BEFORE_EACH_COMPILATION) \ - pdflatex -interaction batchmode $* ; \ - cp $*.pdf $*.c$$n.pdf ; \ - if [[ -a $*.mmz ]] ; then cp $*.mmz $*.mmz.c$$n ; fi ; \ - done ; \ - else \ - pdflatex -interaction batchmode $* ; \ - fi - -%:: %.dtx - sed 's|example|$*|g;' ins.begin > $*.ins - for ((n=1;$$n<=$(N);n++)) ; \ - do sed "s|example|$*|g; s/c1/c$$n/g;" ins.mid >> $*.ins ; \ +# expand_n +# +# $(eval $(call expand_n,n,text)) +# +# $(1) = +# $(2) = +# +# Returns copies of , with "$$n" in text replaced by i = 1 .. n +# Copies of text are separated by a space, and there's a space at the end, too. +# +# Uses the shell to do this. +# +# Example: +# $(call expand_n,3,file$$n.txt) --> 'file1.txt file2.txt file3.txt ' + +define expand_n +$(shell for ((n=1;$$n<=$(or $(1),0);n++)) ; do echo -n "$(2) " ; done) +endef + + +# DTX +# +# $(eval $(call DTX,filename,n)) +# +# $(1) = (may contain suffixes) +# $(2) = , optional +# +# If is not given, define a rule which processes .dtx to +# produce , .listing and .attachment. +# +# If is given, it produces .c, .c.listing and +# .c.attachment, for i = 1 .. n +# +# .ins is produced as an intermediary file. + +define DTX +ifeq ($(2),) +TARGETS += $(1) +DTXS += $(1).dtx +$(1) $(1).listing $(1).attachment &: $(1).dtx +else +TARGETS += $(1).c$(2) +$(call expand_n,$(2),$(1).c$$n $(1).c$$n.listing $(1).c$$n.attachment) &: $(1).dtx +endif + sed 's|example|$(1)|g;' ins.begin > $(1).ins +ifneq ($(2),) + for ((n=1;$$$$n<=$(or $(2),0);n++)) ; \ + do sed "s|example|$(1)|g; s/c1/c$$$$n/g;" ins.mid >> $(1).ins ; \ done - cat ins.end >> $*.ins - tex -interaction batchmode $*.ins - shopt -s nullglob ; sed -i 's/~//g;' $* $*.attachment $*.c? $*.c?.attachment +endif + cat ins.end >> $(1).ins + tex -interaction batchmode $(1).ins + shopt -s nullglob ; \ + sed -i 's/~//g;' $(1) $(1).attachment $(1).c? $(1).c?.attachment +endef -%.listing.attachment: %.listing - sed 's/~//g;' $< > $@ +# PDF +# +# $(eval $(call PDF,basename,n,extra_prereqs,before_each_compilation)) +# +# $(1) = +# $(2) = , optional +# $(3) = extra_prerequisites, optional +# $(4) = before_each_compilation, optional +# +# If is not given, define a rule which compiles .tex (the +# prerequisite) to produce .pdf (the target). +# +# If is given, then for each i = 1 ... n: +# .tex.c is copied to .tex, +# which is compiled into .pdf, +# which is copied to .c.pdf +# All .tex.c are prerequisites. +# .c.pdf are grouped targets. +# +# There is cleaning before compilation. +# +# If extra_prerequisites are given, they are added to prerequisites. +# +# If before_each_compilation is given, it is executed (in bash) just before +# each compilation; the value should end in ";". Use "$$$$n" in the value to +# refer to the compilation cycle number. + +define PDF +ifeq ($(2),) +TARGETS += $(1).pdf +$(1).pdf $(1).mmz &: $(1).tex $(3) +else +TARGETS += $(1).c$(2).pdf +$(call expand_n,$(or $(2),0),$(1).c$$n.pdf $(1).mmz.c$$n) &: $(call expand_n,$(or $(2),0),$(1).tex.c$$n) $(3) +endif + rm -rf $(1).mmz $(1).memo.dir + latexmk -C $(1) || true +ifeq ($(2),) + pdflatex -interaction batchmode $(1) +else + for ((n=1;$$$$n<=$(or $(2),0);n++)) ; do \ + cp $(1).tex.c$$$$n $(1).tex ; $(4) \ + pdflatex -interaction batchmode $(1) ; \ + cp $(1).pdf $(1).c$$$$n.pdf ; \ + if [[ -a $(1).mmz ]] ; then cp $(1).mmz $(1).mmz.c$$$$n ; fi ; \ + done + rm -f $(1).{tex,pdf,mmz} +endif +endef + + +# ATT +# +# $(eval $(call ATT,filename,n,attachment_filename)) +# +# $(1) = +# $(2) = , optional +# $(3) = optional +# +# Copy (.c, if is given) to "attachments" folder. +# The destination is named , if given, otherwise . + +define ATT +ATTACHMENTS += attachments/$$(or $(3),$(1)) +attachments/$$(or $(3),$(1)): $(1)$(if $(2),.c$(2),).attachment + mkdir -p $$(dir $$@) + cp $$< $$@ +endef + + +# DTX+PDF: a shorthand for DTX(,) followed by PDF(,). +define DTX+PDF +$(eval $(call DTX,$(1).tex,$(2))) +$(eval $(call PDF,$(1),$(2))) +endef + +# DTX+ATT: a shorthand for DTX(,) followed by ATT(,). +define DTX+ATT +$(eval $(call DTX,$(1),$(2))) +$(eval $(call ATT,$(1),$(2))) +endef + +# DTX+PDF+ATT: a shorthand for DTX(,) followed by +# PDF(,) and ATT(.tex,) +define DTX+PDF+ATT +$(eval $(call DTX,$(1).tex,$(2))) +$(eval $(call PDF,$(1),$(2))) +$(eval $(call ATT,$(1).tex,$(2))) +endef + + +# Utilities EMPTY :::= SPACE :::= $(EMPTY) $(EMPTY) @@ -57,293 +178,255 @@ SED_MARG_ :::= {[^}]*} GET_FILENAME_FROM_MMZ = etex \ '\input{get-filename-from-mmz}\get{$(1)}{$(2)}{$(3)}{$(4)}{$(5)}' -excerpts: memoize.excerpts advice.excerpts collargs.excerpts +# Various + +%.listing.attachment: %.listing + sed 's/~//g;' $< > $@ %.excerpts: ../../%.edtx - perl extract-excerpts.pl $< && touch $@ + perl extract-excerpts.pl $< > $@ + grep -v '^_' $@ | xargs -r cp -t attachments TARGETS := -# We don't declare any prerequisites for specific attachments, because some of -# these (like .c1 files) are not declared as targets, even if they are -# generated by making a .tex or a .pdf. Instead, we have all attachments -# require all targets at the end of this file. -# -# $(eval $(call ATTACHMENT,input[,output])) -define ATTACHMENT -ifeq ($$(findstring $$(suffix $(1)),.c1.c2.c3.c4.c5.c6.c7.c8.c9),) -# input --> attachments/output or attachments/filename -ATTACHMENTS += attachments/$(1) -attachments/$$(or $(2),$(1)): $(1).attachment - cp $(1).attachment $$@ -else -# filename.c --> attachments/output or attachments/filename -ATTACHMENTS += attachments/$$(basename $(1)) -attachments/$$(or $(2),$$(basename $(1))): $(1).attachment - cp $(1).attachment $$@ -endif -endef +################################################################################ +$(eval $(call DTX+ATT,ConTeXt.tex)) -################################################################################ +$(eval $(call DTX,auto-ref.tex)) -TARGETS += ConTeXt.tex +$(eval $(call DTX,collargs-ignore-other-tags.tex,2)) -TARGETS += _auto-ref.tex +$(eval $(call DTX,collargs-ignore-nesting-true.tex)) -TARGETS += _collargs-ignore-other-tags.tex -_collargs-ignore-other-tags.tex: N = 2 +$(eval $(call DTX+PDF,automemoize-command)) +$(eval $(call ATT,automemoize-command.tex)) -TARGETS += _collargs-verbatim.tex +$(eval $(call DTX+PDF,automemoize-environment)) +$(eval $(call ATT,automemoize-environment.tex)) -TARGETS += automemoize-command.pdf -$(eval $(call ATTACHMENT,automemoize-command.tex)) +$(eval $(call DTX+PDF,beamer)) +$(eval $(call ATT,beamer.tex)) +TARGETS += beamer.cmemo.listing beamer.ccmemo.listing +beamer.cmemo: beamer.mmz + $(call GET_FILENAME_FROM_MMZ,GetFirst,mmzNewCMemo,$<,mymemo,$@) +beamer.cmemo.listing: beamer.cmemo + sed 's/\\mmzSetBeamerOverlays $(SED_MARG)$(SED_MARG)/~\0~/' `tail -1 $<` > $@ +beamer.ccmemo: beamer.mmz + $(call GET_FILENAME_FROM_MMZ,GetFirst,mmzNewCCMemo,$<,mymemo,$@) +beamer.ccmemo.listing: beamer.ccmemo + sed 's/overlay=[0-9]*/~\0~/; s/pauses=[0-9]*/~\0~/; s/}\\mmzIncludeExtern/}\n\\mmzIncludeExtern/; s/\\\mmzStepPgfPictureId/\n\0/; ' `tail -1 $<` > $@ -TARGETS += automemoize-environment.pdf -$(eval $(call ATTACHMENT,automemoize-environment.tex)) +$(eval $(call DTX+ATT,book.tex)) +$(eval $(call DTX+ATT,chapters/chapter1.tex)) -TARGETS += beamer.pdf beamer.cmemo beamer.ccmemo -$(eval $(call ATTACHMENT,beamer.tex)) -beamer.cmemo: beamer.pdf - $(call GET_FILENAME_FROM_MMZ,GetFirst,mmzNewCMemo,$(basename $<).mmz,mymemo,$@) - sed 's/\\mmzSetBeamerOverlays $(SED_MARG)$(SED_MARG)/~\0~/' `tail -1 $@` > $@.listing -beamer.ccmemo: beamer.pdf - $(call GET_FILENAME_FROM_MMZ,GetFirst,mmzNewCCMemo,$(basename $<).mmz,mymemo,$@) - sed 's/overlay=[0-9]*/~\0~/; s/pauses=[0-9]*/~\0~/; s/}\\mmzIncludeExtern/}\n\\mmzIncludeExtern/; s/\\\mmzStepPgfPictureId/\n\0/; ' `tail -1 $@` > $@.listing +$(eval $(call DTX+PDF,capture)) +$(eval $(call ATT,capture.tex)) -TARGETS += book.tex chapters/chapter1.tex -ATTACHMENTS += attachments/chapters/chapter1.tex -attachments/chapters/chapter1.tex: chapters/chapter1.tex - mkdir -p attachments/chapters - cp $< $@ +$(eval $(call DTX,chained-advice.tex)) +$(eval $(call ATT,chained-advice.tex)) -TARGETS += capture.pdf -$(eval $(call ATTACHMENT,capture.tex)) +$(eval $(call DTX+PDF,clean-house)) +$(eval $(call ATT,clean-house.tex)) -TARGETS += chained-advice.tex -$(eval $(call ATTACHMENT,chained-advice.tex)) -chained-advice.tex: N = 3 +$(eval $(call DTX+ATT,collargs-expandable-processor.tex)) -TARGETS += clean-house.pdf -$(eval $(call ATTACHMENT,clean-house.tex)) +$(eval $(call DTX+ATT,collargs-makebox.tex)) -TARGETS += collargs-expandable-processor.tex +$(eval $(call DTX+ATT,collargs-minipage.tex)) -TARGETS += collargs-makebox.tex +$(eval $(call DTX+ATT,collargs-nodelimiters.tex)) -TARGETS += collargs-minipage.tex +$(eval $(call DTX+ATT,collargs-processor.tex)) -TARGETS += collargs-nodelimiters.tex +$(eval $(call DTX+ATT,collargs-return-no.tex)) -TARGETS += collargs-processor.tex +$(eval $(call DTX+ATT,collargs-return-plain.tex)) -TARGETS += collargs-return-no.tex +$(eval $(call DTX+ATT,collargs-transition-comment.tex)) -TARGETS += collargs-return-plain.tex +$(eval $(call DTX+ATT,collargs-transition-cs.tex)) -TARGETS += collargs-transition-comment.tex +$(eval $(call DTX+ATT,collargs-transition-ok.tex)) -TARGETS += collargs-transition-cs.tex +$(eval $(call DTX+ATT,collargs-verbatim.tex)) -TARGETS += collargs-transition-ok.tex +$(eval $(call DTX,countdown.sty,2)) +$(eval $(call DTX,countdown.tex,2)) +$(eval $(call PDF,countdown,2,countdown.sty.c2,cp countdown.sty.c1 countdown.sty;)) +$(eval $(call ATT,countdown.tex,1)) +$(eval $(call ATT,countdown.sty,1)) +$(eval $(call ATT,countdown.sty,2,countdown-integrated-driver.sty)) -TARGETS += collargs-verbatim.tex +$(eval $(call DTX+PDF,dirty-house)) +$(eval $(call ATT,dirty-house.tex)) -TARGETS += countdown.pdf countdown.sty -countdown.sty: N = 2 -countdown.pdf: countdown.sty -countdown.pdf: N = 2 -countdown.pdf: BEFORE_EACH_COMPILATION = cp $*.sty.c1 $*.sty ; -$(eval $(call ATTACHMENT,countdown.tex.c1)) -$(eval $(call ATTACHMENT,countdown.sty.c1)) -$(eval $(call ATTACHMENT,countdown.sty.c2,countdown-integrated-driver.sty)) +$(eval $(call DTX+ATT,disable-auto-cmd.tex)) -TARGETS += dirty-house.pdf -$(eval $(call ATTACHMENT,dirty-house.tex)) +$(eval $(call DTX+ATT,disable-auto-env.tex)) -TARGETS += disable-auto-cmd.tex -$(eval $(call ATTACHMENT,disable-auto-cmd.tex)) +$(eval $(call DTX+ATT,disable-bad.tex)) -TARGETS += disable-auto-env.tex -$(eval $(call ATTACHMENT,disable-auto-env.tex)) +$(eval $(call DTX+ATT,disable-good.tex)) -TARGETS += disable-bad.tex -$(eval $(call ATTACHMENT,disable-bad.tex)) +$(eval $(call DTX+ATT,disable-nomemoize.tex)) -TARGETS += disable-good.tex -$(eval $(call ATTACHMENT,disable-good.tex)) +$(eval $(call DTX+ATT,disable-nommz.tex)) -TARGETS += disable-nomemoize.tex -$(eval $(call ATTACHMENT,disable-nomemoize.tex)) +$(eval $(call DTX+PDF+ATT,disable)) -TARGETS += disable-nommz.tex -$(eval $(call ATTACHMENT,disable-nommz.tex)) +$(eval $(call DTX+PDF,fontsize,2)) +$(eval $(call ATT,fontsize.tex,1)) -TARGETS += disable.pdf -$(eval $(call ATTACHMENT,disable.tex)) +$(eval $(call DTX+PDF+ATT,label,3)) +TARGETS += label.ccmemo.listing +label.ccmemo: label.mmz.c1 + $(call GET_FILENAME_FROM_MMZ,GetFirst,mmzNewCCMemo,$<,mymemo,$@) +label.ccmemo.listing: label.ccmemo + sed 's/\\quitvmode \\mmzIncludeExtern/\\quitvmode\n\\mmzIncludeExtern/; s/$(SED_MARG)\\mmzIncludeExtern/{\1}\n\\mmzIncludeExtern/; s/\\mmzLabel *$(SED_MARG)$(SED_MARG)/~\\mmzLabel{\1}{\2}~ /g; s/\\\mmzStepPgfPictureId/\n\0/; ' `tail -1 $<` > $@ -TARGETS += fontsize.pdf -fontsize.pdf: N = 2 -$(eval $(call ATTACHMENT,fontsize.tex)) +$(eval $(call DTX,label+.tex,6)) +$(eval $(call PDF,label+,2)) +TARGETS += label+.ccmemo.listing +label+.ccmemo: label+.mmz.c1 + $(call GET_FILENAME_FROM_MMZ,GetFirst,mmzNewCCMemo,$<,mymemo,$@) +label+.ccmemo.listing: label+.ccmemo + sed 's/\\mmzLabel *$(SED_MARG)$(SED_MARG)/~\0~/; s/$(SED_MARG)\\mmzIncludeExtern/\1 \\mmzIncludeExtern/; s/\($(SED_MARG_)$(SED_MARG_)$(SED_MARG_)\)\($(SED_MARG_)$(SED_MARG_)$(SED_MARG_)$(SED_MARG_)\)/\1 \2/;' `tail -1 $<` > $@ +$(eval $(call ATT,label+.tex,1)) +$(eval $(call ATT,label+.tex,3,label+mmzNoRef.tex)) +$(eval $(call ATT,label+.tex,4,label+context.tex)) +$(eval $(call ATT,label+.tex,5,label+listii.tex)) +$(eval $(call ATT,label+.tex,6,label+auto.tex)) -TARGETS += label.pdf label.ccmemo -label.pdf: N = 3 -label.ccmemo: label.pdf - $(call GET_FILENAME_FROM_MMZ,GetFirst,mmzNewCCMemo,$(basename $<).mmz.c1,mymemo,$@) - sed 's/\\quitvmode \\mmzIncludeExtern/\\quitvmode\n\\mmzIncludeExtern/; s/$(SED_MARG)\\mmzIncludeExtern/{\1}\n\\mmzIncludeExtern/; s/\\mmzLabel *$(SED_MARG)$(SED_MARG)/~\\mmzLabel{\1}{\2}~ /g; s/\\\mmzStepPgfPictureId/\n\0/; ' `tail -1 $@` > $@.listing -$(eval $(call ATTACHMENT,label.tex.c1)) +$(eval $(call DTX+PDF+ATT,manual)) -TARGETS += label+.pdf label+.ccmemo -label+.pdf: N = 2 -label+.tex: N = 6 -label+.ccmemo: label+.pdf - $(call GET_FILENAME_FROM_MMZ,GetFirst,mmzNewCCMemo,$(basename $<).mmz.c1,mymemo,$@) - sed 's/\\mmzLabel *$(SED_MARG)$(SED_MARG)/~\0~/; s/$(SED_MARG)\\mmzIncludeExtern/\1 \\mmzIncludeExtern/; s/\($(SED_MARG_)$(SED_MARG_)$(SED_MARG_)\)\($(SED_MARG_)$(SED_MARG_)$(SED_MARG_)$(SED_MARG_)\)/\1 \2/;' `tail -1 $@` > $@.listing +$(eval $(call DTX+PDF,meaning-to-context,2)) +$(eval $(call ATT,meaning-to-context.tex,1)) -$(eval $(call ATTACHMENT,label+.tex)) -$(eval $(call ATTACHMENT,label+.tex.c3,label+mmzNoRef.tex)) -$(eval $(call ATTACHMENT,label+.tex.c4,label+context.tex)) -$(eval $(call ATTACHMENT,label+.tex.c5,label+listii.tex)) -$(eval $(call ATTACHMENT,label+.tex.c6,label+auto.tex)) +$(eval $(call DTX+ATT,memoize-example.cfg)) -TARGETS += manual.pdf -$(eval $(call ATTACHMENT,manual.tex)) +$(eval $(call DTX+PDF,memoize-internal,2)) +$(eval $(call ATT,memoize-internal.tex,1)) -TARGETS += meaning-to-context.pdf -meaning-to-context.pdf: N = 2 -$(eval $(call ATTACHMENT,meaning-to-context.tex.c1)) +$(eval $(call DTX+ATT,memoize-region.cfg)) -TARGETS += memoize-example.cfg -$(eval $(call ATTACHMENT,memoize-example.cfg)) +$(eval $(call DTX+PDF+ATT,mmztikz)) -TARGETS += memoize-internal.pdf -memoize-internal.pdf: N = 2 -$(eval $(call ATTACHMENT,memoize-internal.tex.c1)) +$(eval $(call DTX+PDF,no-linebreaking,2)) +$(eval $(call ATT,no-linebreaking.tex,1)) -TARGETS += memoize-region.cfg -$(eval $(call ATTACHMENT,memoize-region.cfg)) +$(eval $(call DTX+PDF+ATT,om-collector-NewDocumentCommand)) -TARGETS += mmztikz.pdf -$(eval $(call ATTACHMENT,mmztikz.tex)) +$(eval $(call DTX+PDF+ATT,om-collector-newcommand)) -TARGETS += no-linebreaking.pdf -no-linebreaking.pdf: N = 2 -$(eval $(call ATTACHMENT,no-linebreaking.tex.c1)) +$(eval $(call DTX+PDF,overlay,4)) +$(eval $(call ATT,overlay.tex,1)) +$(eval $(call ATT,overlay.tex,2,overlay-no-padding.tex)) +$(eval $(call ATT,overlay.tex,3,overlay-default-padding.tex)) +$(eval $(call ATT,overlay.tex,4,overlay-extra-padding.tex)) -TARGETS += om-collector-NewDocumentCommand.tex -$(eval $(call ATTACHMENT,om-collector-NewDocumentCommand.tex)) +$(eval $(call DTX+ATT,per-overlay-v1.sty)) -TARGETS += om-collector-newcommand.tex -$(eval $(call ATTACHMENT,om-collector-newcommand.tex)) +$(eval $(call DTX+PDF+ATT,pgfmathparse-embellished)) -TARGETS += overlay.pdf -overlay.pdf: N = 4 +$(eval $(call DTX+PDF+ATT,pgfmathparse)) +TARGETS += pgfmathparse.ccmemo +pgfmathparse.ccmemo: pgfmathparse.mmz + $(call GET_FILENAME_FROM_MMZ,GetFirst,mmzNewCCMemo,$<,mymemo,$@) -$(eval $(call ATTACHMENT,overlay.tex.c1)) -$(eval $(call ATTACHMENT,overlay.tex.c2,overlay-no-padding.tex)) -$(eval $(call ATTACHMENT,overlay.tex.c3,overlay-default-padding.tex)) -$(eval $(call ATTACHMENT,overlay.tex.c4,overlay-extra-padding.tex)) +$(eval $(call DTX+ATT,plainTeX.tex)) -TARGETS += per-overlay-v1.sty -$(eval $(call ATTACHMENT,per-overlay-v1.sty)) +poormansbox.pdf: poormansbox.sty +$(eval $(call DTX+ATT,poormansbox.sty)) +$(eval $(call DTX+PDF+ATT,poormansbox)) + +$(eval $(call DTX+ATT,poormansbox-memoizable.sty)) +# We compile only to test. +$(eval $(call PDF,poormansbox-memoizable)) +poormansbox-memoizable.tex: poormansbox.tex + sed 's/\\usepackage{poormansbox}/\\usepackage{poormansbox-memoizable}/' $< > $@ +poormansbox-memoizable.pdf: poormansbox-memoizable.sty +TARGETS += poormansbox-memoizable.cmemo.listing +poormansbox-memoizable.cmemo: poormansbox-memoizable.mmz + $(call GET_FILENAME_FROM_MMZ,GetLast,mmzNewCMemo,$<,mymemo,$@) +poormansbox-memoizable.cmemo.listing: poormansbox-memoizable.cmemo + sed 's/]{/]\n {/;' `tail -1 $<` > $@ -TARGETS += pgfmathparse-embellished.pdf -$(eval $(call ATTACHMENT,pgfmathparse-embellished.tex)) +$(eval $(call DTX+ATT,poormansbox-driver.sty)) +poormansbox-driver.tex.c1 poormansbox-driver.tex.c2: poormansbox.tex + sed 's/\\usepackage{poormansbox}/\\usepackage{poormansbox-driver}/' $< > $@ +$(eval $(call PDF,poormansbox-driver,2,poormansbox-driver.sty)) +TARGETS += poormansbox-driver.ccmemo.listing +poormansbox-driver.ccmemo: poormansbox-driver.mmz.c1 + $(call GET_FILENAME_FROM_MMZ,GetSecond,mmzNewCCMemo,$<,mymemo,$@) +poormansbox-driver.ccmemo.listing: poormansbox-driver.ccmemo + sed 's/\\csuse *{poormansbox@outer}/~\0~/; s/{\\mmzIncludeExtern.*}}/~\0~/' `tail -1 $<` > $@ -TARGETS += pgfmathparse.pdf pgfmathparse.ccmemo -pgfmathparse.ccmemo: pgfmathparse.pdf - $(call GET_FILENAME_FROM_MMZ,GetFirst,mmzNewCCMemo,$(basename $<).mmz,mymemo,$@) -$(eval $(call ATTACHMENT,pgfmathparse.tex)) +$(eval $(call DTX+PDF,progressbar,2)) +$(eval $(call ATT,progressbar.tex,1)) -TARGETS += plainTeX.tex +$(eval $(call DTX+PDF,readonly,2)) +$(eval $(call ATT,readonly.tex,1)) -TARGETS += poormansbox.pdf poormansbox.sty -poormansbox.pdf: poormansbox.sty -$(eval $(call ATTACHMENT,poormansbox.tex)) -$(eval $(call ATTACHMENT,poormansbox.sty)) +$(eval $(call DTX+PDF,recompile,3)) +$(eval $(call ATT,recompile.tex,1)) -TARGETS += poormansbox-memoizable.pdf poormansbox-memoizable.sty poormansbox-memoizable.cmemo -poormansbox-memoizable.pdf: poormansbox-memoizable.sty -poormansbox-memoizable.cmemo: poormansbox-memoizable.pdf - $(call GET_FILENAME_FROM_MMZ,GetLast,mmzNewCMemo,$(basename $<).mmz,mymemo,$@) - sed 's/]{/]\n {/;' `tail -1 $@` > $@.listing -$(eval $(call ATTACHMENT,poormansbox-memoizable.sty)) - -TARGETS += poormansbox-driver.pdf poormansbox-driver.sty poormansbox-driver.ccmemo -poormansbox-driver.pdf: N = 2 -poormansbox-driver.pdf: poormansbox-driver.sty -poormansbox-driver.ccmemo: poormansbox-driver.pdf - $(call GET_FILENAME_FROM_MMZ,GetSecond,mmzNewCCMemo,$(basename $<).mmz.c1,mymemo,$@) - sed 's/\\csuse *{poormansbox@outer}/~\0~/; s/{\\mmzIncludeExtern.*}}/~\0~/' `tail -1 $@` > $@.listing -$(eval $(call ATTACHMENT,poormansbox-driver.tex.c1)) -$(eval $(call ATTACHMENT,poormansbox-driver.sty)) - -TARGETS += progressbar.pdf -progressbar.pdf: N = 2 -$(eval $(call ATTACHMENT,progressbar.tex.c1)) - -TARGETS += readonly.pdf -readonly.pdf: N = 2 -$(eval $(call ATTACHMENT,readonly.tex.c1)) - -TARGETS += recompile.pdf -recompile.pdf: N = 3 -$(eval $(call ATTACHMENT,recompile.tex.c1)) - -TARGETS += record-extern-pages.tex -$(eval $(call ATTACHMENT,record-extern-pages.tex)) - -TARGETS += record-files.tex -$(eval $(call ATTACHMENT,record-files.tex)) - -TARGETS += redefinitions.pdf -redefinitions.pdf: N = 7 -$(eval $(call ATTACHMENT,redefinitions.tex.c1)) - -TARGETS += ref.pdf ref.cmemo -ref.pdf: N = 7 -ref.cmemo: ref.pdf - $(call GET_FILENAME_FROM_MMZ,GetFirst,mmzNewCMemo,$(basename $<).mmz.c1,mymemo,$@) - sed 's/\\global.*/~\0~/' `tail -1 $@` > $@.listing -$(eval $(call ATTACHMENT,ref.tex.c3)) -$(eval $(call ATTACHMENT,ref.tex.c7,ref-force.tex)) - -TARGETS += salt.pdf -$(eval $(call ATTACHMENT,salt.tex)) - -TARGETS += sectionbox.tex -$(eval $(call ATTACHMENT,sectionbox.tex)) - -TARGETS += skak.pdf -$(eval $(call ATTACHMENT,skak.tex)) - -TARGETS += test.pdf -$(eval $(call ATTACHMENT,test.tex)) - -TARGETS += titlepage.pdf titlepage.mmz.c1 titlepage.mmz.c2 titlepage.ccmemo titlepage.cmemo -titlepage.pdf: N = 2 -titlepage.mmz.c1: titlepage.pdf - sed -i 's/\\mmzNewExtern/~\0~/' $@ -titlepage.mmz.c2: titlepage.pdf - sed -i 's/\\mmzUsedExtern/~\0~/' $@ -titlepage.cmemo: titlepage.pdf - $(call GET_FILENAME_FROM_MMZ,GetFirst,mmzNewCMemo,$(basename $<).mmz.c1,mymemo,$@) -titlepage.ccmemo: titlepage.pdf - $(call GET_FILENAME_FROM_MMZ,GetFirst,mmzNewCCMemo,$(basename $<).mmz.c1,mymemo,$@) - sed 's/\\quitvmode \\mmzIncludeExtern/\\quitvmode\n\\mmzIncludeExtern/; s/\\\mmzStepPgfPictureId/\n\0/' `tail -1 titlepage.ccmemo` > $@.listing -$(eval $(call ATTACHMENT,titlepage.tex)) - -TARGETS += verbatim-auto.pdf -$(eval $(call ATTACHMENT,verbatim-auto.tex)) - -TARGETS += verbatim-manual.pdf -$(eval $(call ATTACHMENT,verbatim-manual.tex)) - -TARGETS += vref.tex -$(eval $(call ATTACHMENT,vref.tex)) +$(eval $(call DTX+ATT,record-extern-pages.tex)) + +$(eval $(call DTX+ATT,record-files.tex)) + +$(eval $(call DTX+PDF,redefinitions,7)) +$(eval $(call ATT,redefinitions.tex,1)) + +$(eval $(call DTX+PDF,ref,7)) +$(eval $(call ATT,ref.tex,3)) +$(eval $(call ATT,ref.tex,7,ref-force.tex)) +TARGETS += ref.cmemo.listing +ref.cmemo: ref.mmz.c1 + $(call GET_FILENAME_FROM_MMZ,GetFirst,mmzNewCMemo,$<,mymemo,$@) +ref.cmemo.listing: ref.cmemo + sed 's/\\global.*/~\0~/' `tail -1 $<` > $@ + +$(eval $(call DTX+PDF+ATT,salt)) + +$(eval $(call DTX+ATT,sectionbox.tex)) + +$(eval $(call DTX+PDF+ATT,skak)) + +$(eval $(call DTX+PDF+ATT,test)) + +$(eval $(call DTX+PDF+ATT,titlepage,2)) +TARGETS += titlepage.mmz-pre titlepage.mmz-post \ + titlepage.cmemo titlepage.ccmemo.listing +titlepage.mmz-pre: titlepage.mmz.c1 + sed 's/\\mmzNewExtern/~\0~/' $< > $@ +titlepage.mmz-post: titlepage.mmz.c2 + sed 's/\\mmzUsedExtern/~\0~/' $< > $@ +titlepage.cmemo: titlepage.mmz.c1 + $(call GET_FILENAME_FROM_MMZ,GetFirst,mmzNewCMemo,$<,mymemo,$@) +titlepage.ccmemo: titlepage.mmz.c1 + $(call GET_FILENAME_FROM_MMZ,GetFirst,mmzNewCCMemo,$<,mymemo,$@) +titlepage.ccmemo.listing: titlepage.ccmemo + sed 's/\\quitvmode \\mmzIncludeExtern/\\quitvmode\n\\mmzIncludeExtern/; s/\\\mmzStepPgfPictureId/\n\0/' `tail -1 $<` > $@ + +$(eval $(call DTX+PDF+ATT,verbatim-auto)) + +$(eval $(call DTX+PDF+ATT,verbatim-manual)) + +$(eval $(call DTX+ATT,vref.tex)) ################################################################################ -$(ATTACHMENTS): $(TARGETS) -all: excerpts $(TARGETS) $(ATTACHMENTS) +TARGETS += $(ATTACHMENTS) + +../examples.zip: $(ATTACHMENTS) memoize.excerpts advice.excerpts collargs.excerpts + rm -f $@ + cd attachments && grep -hv '^_' ../memoize.excerpts ../advice.excerpts ../collargs.excerpts | xargs -r zip -r ../$@ $(ATTACHMENTS:attachments/%=%) + +../examples-src.zip: Makefile ins.begin ins.mid ins.end memoize.cfg \ + extract-excerpts.pl get-filename-from-mmz.tex $(DTXS) + rm -f $@ + zip -r $@ $^ + +all: $(TARGETS) ../examples.zip ../examples-src.zip diff --git a/doc/examples/_auto-ref.tex.dtx b/doc/examples/auto-ref.tex.dtx similarity index 100% rename from doc/examples/_auto-ref.tex.dtx rename to doc/examples/auto-ref.tex.dtx diff --git a/doc/examples/chained-advice.tex.dtx b/doc/examples/chained-advice.tex.dtx index 04ca644..f7e17a1 100644 --- a/doc/examples/chained-advice.tex.dtx +++ b/doc/examples/chained-advice.tex.dtx @@ -1,6 +1,5 @@ -%\documentclass[varwidth]{standalone} %\documentclass{article} -%\usepackage{advice} +%\usepackage{advice} \def\foo#1{``#1''} \def\fboxWrap#1{\fbox{\AdviceOriginal{#1}}} @@ -9,7 +8,7 @@ \pgfqkeys{~/one~}{.install advice, advice'=\foo{args=m, outer handler=~\fboxWrap~}} \pgfqkeys{~/two~}{.install advice, advice'=\foo{args=m, outer handler=~\parenWrap~}} -%\begin{document} +%\begin{document} {\pgfkeys{~/one~/activate=\foo, ~/two~/activate=\foo}\foo{bar}} {\pgfkeys{~/two~/activate=\foo, ~/one~/activate=\foo}\foo{bar}} -%\end{document} +%\end{document} diff --git a/doc/examples/_collargs-verbatim.tex.dtx b/doc/examples/collargs-ignore-nesting-true.tex.dtx similarity index 100% rename from doc/examples/_collargs-verbatim.tex.dtx rename to doc/examples/collargs-ignore-nesting-true.tex.dtx diff --git a/doc/examples/_collargs-ignore-other-tags.tex.dtx b/doc/examples/collargs-ignore-other-tags.tex.dtx similarity index 100% rename from doc/examples/_collargs-ignore-other-tags.tex.dtx rename to doc/examples/collargs-ignore-other-tags.tex.dtx diff --git a/doc/examples/extract-excerpts.pl b/doc/examples/extract-excerpts.pl index 20a6f64..011d8f6 100644 --- a/doc/examples/extract-excerpts.pl +++ b/doc/examples/extract-excerpts.pl @@ -22,6 +22,7 @@ # upon encountering " % \begin{listingregion}{}", # open the excerpt file, initialize the excerpt list open LISTING, ">$1.excerpt"; + print("$1.excerpt\n"); $in_listing = 1; @lines = (); } diff --git a/doc/examples/poormansbox-driver.tex.dtx b/doc/examples/poormansbox-driver.tex.dtx deleted file mode 100644 index 78eb0ff..0000000 --- a/doc/examples/poormansbox-driver.tex.dtx +++ /dev/null @@ -1,44 +0,0 @@ -%<*!lst> -\documentclass{article} -\usepackage[a5paper,margin=1cm,noheadfoot]{geometry} -\pagestyle{empty} -\usepackage{lipsum} - -%% This document works with all the poormanbox packages developed in the -%% manual. Uncomment the one one you want to test. Also feel free to remove the -%% line loading Memoize, all poormanbox packages should work without it, even if -%% they support it. - -\usepackage{memoize} - -%% \usepackage{poormansbox} -%% \usepackage{poormansbox-memoizable} -\usepackage{poormansbox-driver} - -% -\parskip 1ex plus 0.5ex minus 0.5ex - -\begin{document} -\lipsum[3] - -\begin{~poormansbox~}[width=.8\linewidth] - ~\pmbset~{width=\linewidth} - \lipsum[101] - \begin{~poormansbox~}[frame] - \footnotesize\lipsum[66] - \end{~poormansbox~} - \lipsum[75] -\end{~poormansbox~} - -\lipsum[4] - -\begin{~poormansbox~}[ - width=.6\linewidth, frame, - before=\noindent\llap{---}, - after=--- - ] - \lipsum[65] -\end{~poormansbox~}Framed. - -\lipsum[144] -\end{document} diff --git a/doc/examples/poormansbox-memoizable.tex.dtx b/doc/examples/poormansbox-memoizable.tex.dtx deleted file mode 100644 index d774dac..0000000 --- a/doc/examples/poormansbox-memoizable.tex.dtx +++ /dev/null @@ -1,44 +0,0 @@ -%<*!lst> -\documentclass{article} -\usepackage[a5paper,margin=1cm,noheadfoot]{geometry} -\pagestyle{empty} -\usepackage{lipsum} - -%% This document works with all the poormanbox packages developed in the -%% manual. Uncomment the one one you want to test. Also feel free to remove the -%% line loading Memoize, all poormanbox packages should work without it, even if -%% they support it. - -\usepackage{memoize} - -%% \usepackage{poormansbox} -\usepackage{poormansbox-memoizable} -%% \usepackage{poormansbox-driver} - -% -\parskip 1ex plus 0.5ex minus 0.5ex - -\begin{document} -\lipsum[3] - -\begin{~poormansbox~}[width=.8\linewidth] - ~\pmbset~{width=\linewidth} - \lipsum[101] - \begin{~poormansbox~}[frame] - \footnotesize\lipsum[66] - \end{~poormansbox~} - \lipsum[75] -\end{~poormansbox~} - -\lipsum[4] - -\begin{~poormansbox~}[ - width=.6\linewidth, frame, - before=\noindent\llap{---}, - after=--- - ] - \lipsum[65] -\end{~poormansbox~}Framed. - -\lipsum[144] -\end{document} diff --git a/doc/memoize-doc.sty b/doc/memoize-doc.sty index c0d0c46..74f6942 100644 --- a/doc/memoize-doc.sty +++ b/doc/memoize-doc.sty @@ -214,41 +214,21 @@ fonttitle={\small\hypercolor{link}{white}}, }, example title/.default=\examplename.tex, - attachment/.estore in=\attachmentpath, - attachment name/.estore in=\attachmentname, - attachment name/.default=noname.tex, + attachment/.estore in=\attachmentname, no attachment/.style={attach/.style={}}, - attachment name, attach/.style={ overlay app={% \node at (frame.north east) [ fill=white, draw=gray, thick, ellipse, inner xsep=-0.5mm, inner ysep=0, shift={(-2mm,-2mm)}, rotate=45, ]{% - \expandafter\myattachandlink\expandafter[\attachmentname]{\attachmentpath}[application/x-tex]{Click here to open the code.}{\rotatebox{-45}{\faPaperclip}} + \expandafter\attachandlink\expandafter[\attachmentname]{\attachmentsdir\attachmentname}[application/x-tex]{Click here to open the code.}{\rotatebox{-45}{\faPaperclip}} }; } }, } \NewDocumentCommand\attachexample{O{\examplename.tex} O{\examplepath.tex.c1.attachment}}{% - {\textsuperscript{\kern-0.25em \expandafter\myattachandlink\expandafter[#1]{#2}[application/x-tex]{Click here to open the code.}{\rotatebox{-45}{\faPaperclip}}\kern-0.25em \relax}}} -\newcommand\myattachandlink[2][\filename]{% - \begingroup - \def\filename{#2}% - \immediate\write\attachments{#2 #1 ## line \the\inputlineno}% - \ifmemoizing - \xtoksapp\mmzCCMemo{% - \immediate\write\attachments{#2 #1 ## line \the\inputlineno}% - }% - \fi - \expanded{% - \endgroup - \noexpand\attachandlink[#1]{#2}% - }% -} -\newwrite\attachments -\immediate\openout\attachments attachments.lst -\AtEndDocument{\immediate\closeout\attachments} + {\textsuperscript{\kern-0.25em \expandafter\attachandlink\expandafter[#1]{#2}[application/x-tex]{Click here to open the code.}{\rotatebox{-45}{\faPaperclip}}\kern-0.25em \relax}}} \NewTCBInputListing{\tcbinputexample}{ >{\edef\ProcessedArgument} m O{.tex} D(){} +m } @@ -261,13 +241,17 @@ example title={#1#2}, % enlarge left by=\leftmargin,% this takes care of using this box in lists listing and comment, - one file/.style={ + no .listing/.style={ listing file={\exampledir#1#2#3}, - attachment={\exampledir#1#2#3}, + %attachment path={\exampledir#1#2#3}, + %attachment path={\exampledir attachments/#1#2}, + %attachment={#1#2}, }, listing file=\exampledir#1#2#3.listing, - attachment=\exampledir#1#2#3.attachment, - attachment name=#1#2,% + %attachment path=\exampledir#1#2#3.attachment, + %attachment path=\exampledir attachments/#1#2, + %attachment name=#1#2,% + attachment=#1#2,% #4, attach, } diff --git a/doc/memoize-doc.tex b/doc/memoize-doc.tex index 63de824..df6e84d 100644 --- a/doc/memoize-doc.tex +++ b/doc/memoize-doc.tex @@ -14,6 +14,7 @@ % trace, } \def\exampledir{examples/} +\def\attachmentsdir{examples/attachments/} \title{\pkg[white]{Memoize}} \ParseProvidesPackage @@ -1567,7 +1568,7 @@ \subsection{When stuff sticks out} \tcbinputexample{overlay}(.c2){ after title pre={\ (memoization without padding)}, - attachment name=\examplename-no-padding.tex, + attachment=overlay-no-padding.tex, sidebyside, lefthand ratio=0.3, comment={\centering \includeexamplepdf[size=minimal,boxrule=0.5mm,extern page, @@ -1590,7 +1591,7 @@ \subsection{When stuff sticks out} \tcbinputexample{overlay}(.c3){ after title pre={\ (memoization with default padding)}, - attachment name=\examplename-default-padding.tex, + attachment=overlay-default-padding.tex, listing and comment, middle=0.9mm, comment={\centering @@ -1608,7 +1609,7 @@ \subsection{When stuff sticks out} \tcbinputexample{overlay}(.c4){ after title pre={\ (memoization with extra padding)}, - attachment name=\examplename-extra-padding.tex, + attachment=overlay-extra-padding.tex, listing and comment, middle=0.9mm, comment={\centering @@ -2414,7 +2415,7 @@ \subsection{From cross-references to the context} \tcbinputexample{ref}(.c7){ after title pre={\ (after the fresh compilation with \refmmzauto{force ref})}, - attachment name=\examplename-force.tex, + attachment=ref-force.tex, comment={\centering \includeexamplepdf[extern page](.c1){page=1,trim=1in 1in 1in 1in}\quad \includeexamplepdf[document page](.c1){page=2} @@ -3347,7 +3348,7 @@ \subsubsection{More on \texorpdfstring{\cs{label}}{\textbackslash label}} referencing works as usual. However, problems arise when we automemoize the inner environment. -\tcbinputexample{label+}{ +\tcbinputexample{label+}(.c1){ sidebyside, lefthand ratio=0.53, comment={\centering\includeexamplepdf[document page](.c2){page=1}}, } @@ -3428,7 +3429,7 @@ \subsubsection{More on \texorpdfstring{\cs{label}}{\textbackslash label}} section~\ref{sec:tut:automemoization-details} or~\ref{sec:ref:advice}). \tcbinputexample{label+}(.c6){listing only, float, - attachment name=label+auto.tex, + attachment=label+auto.tex, } Within \refcmd{AdviceSetup}, we prefix (using macro \cs{preto} of package @@ -3581,7 +3582,7 @@ \subsubsection{The Beamer support explained} \medskip % manual, to avoid an orphan \tcbinputexample{per-overlay}[.excerpt]{% - listing only, one file, + listing only, no .listing, title={The implementation of \refmmz{per overlay}}, } @@ -3703,13 +3704,13 @@ \subsubsection{The \texttt{.mmz} file} produced by the titlepage illustration. In fact, we have two versions of this file, as it changes upon the second compilation. -\tcbinputexample{titlepage}[.mmz](.c1){ - listing only, one file, no attachment, float, +\tcbinputexample{titlepage}[.mmz-pre]{ + listing only, no .listing, no attachment, float, after title pre={\ (after the first compilation)}, listing options app={breakatwhitespace=false,prebreak=\coloredpercentchar}, } -\tcbinputexample{titlepage}[.mmz](.c2){ - listing only, one file, no attachment, float, +\tcbinputexample{titlepage}[.mmz-post]{ + listing only, no .listing, no attachment, float, after title pre={\ (after subsequent compilations)}, listing options app={breakatwhitespace=false,prebreak=\coloredpercentchar}, } @@ -3918,7 +3919,7 @@ \subsubsection{The default memoization driver} of the driver line by line: \tcbinputexample{single-extern-driver}[.excerpt]{% - listing only, one file, + listing only, no .listing, listing options app={numbers=left, numberstyle=\tiny, numbersep=0.5em}, title=The default memoization driver, float, no attachment, @@ -4092,7 +4093,7 @@ \subsubsection{Multiple externs per memo} }% \def\mmzNewExtern##1##2##3##4{\mmzUsedExtern{##1}} \def\myexternname##1{extern \dots\texttt{\mytemp##1.pdf}}% - \input{\examplepath.mmz}% + \input{\examplepath.mmz.c1}% \begin{tabular}{ccc} \includeexamplepdf[extern page,title/.expand once=\myexternname{}] {page=2,trim=1in 1in 1in 1in,scale=0.333}& @@ -4191,8 +4192,10 @@ \subsubsection{Multiple externs per memo} integrated drivers of potentially recursive commands; we will talk about this in section~\ref{sec:memoization-complex-single-driver}.} -\tcbinputexample{countdown}[.sty](.c2){listing only, after title pre={\ (version 2)}, - attachment name=countdown-integrated-driver.sty, +\tcbinputexample{countdown}[.sty](.c2){ + listing only, + after title pre={\ (version 2)}, + attachment=countdown-integrated-driver.sty, } @@ -4218,7 +4221,7 @@ \subsubsection{Driver-based memoizable design} primarily intended to put some stretchable vertical space around the box. The document -source\attachexample[poormansbox-driver.tex][\exampledir poormansbox-driver.tex.c1.attachment] +source\attachexample[poormansbox-driver.tex][\exampledir poormansbox.tex.attachment] and the resulting PDF of the example are the same as in section~\ref{sec:memoizable-design}, so we will not repeat them here, but jump directly into a revised definition of the environment. We will retain the core @@ -4637,7 +4640,7 @@ \subsubsection{Using package Advice} course followed by the environment name. \tcbinputexample{_auto-memoize-inner}[.excerpt]{% - listing and comment, one file, no attachment, + listing and comment, no .listing, no attachment, title={The implementation of the \refmmzauto{inner handler} for automemoization}, comment={% @@ -4658,7 +4661,7 @@ \subsubsection{Using package Advice} default outer handler. \tcbinputexample{_auto-memoize-outer}[.excerpt]{% - listing only, one file, no attachment, + listing only, no .listing, no attachment, title={The implementation of the \refmmzauto{outer handler} for automemoization}, } @@ -4675,7 +4678,7 @@ \subsubsection{Using package Advice} \refcmd{AdviceRunfalse} in branches where the run conditions are not satisfied. \tcbinputexample{_auto-run-if-memoization-is-possible}[.excerpt]{% - listing only, one file, no attachment, + listing only, no .listing, no attachment, title={The implementation of \refmmzauto{run if memoization is possible}}, } @@ -4692,7 +4695,7 @@ \subsubsection{Using package Advice} next instance of (auto)memoization. \tcbinputexample{_auto-memoize-bailout}[.excerpt]{% - listing only, one file, no attachment, + listing only, no .listing, no attachment, title={The implementation of the \refmmzauto{bailout handler} for automemoization}, } @@ -4723,7 +4726,7 @@ \subsubsection{Using package Advice} uncollected. It then asks \refcmd{mmzNoRef} to do the real job of getting the reference key into the context, and finally executes the original \cs{ref}. -\tcbinputexample{_auto-ref}{% +\tcbinputexample{auto-ref}{% listing only, no attachment, title={\hypercolor{link}{white}A simplified\footnotemark{} definition of \refmmzauto{ref}}, @@ -4747,7 +4750,7 @@ \subsubsection{Using package Advice} the execution of the original command after the run conditions are ``checked.'' \tcbinputexample{_auto-abort}[.excerpt]{% - listing only, one file, no attachment, + listing only, no .listing, no attachment, title={The definition of \refmmzauto{abort}}, } @@ -4771,7 +4774,7 @@ \subsubsection{Using package Advice} effect, the box will appear within parenthesis; if we reverse the activation order, the parenthesis will appear inside the box. -\tcbinputexample{chained-advice}{comment=\input{\examplepath.tex.c2}} +\tcbinputexample{chained-advice}{comment=\input{\examplepath}} First of all, looking at the code above, you have probably noticed the absence of key \refmmz{auto}. This is because by default, \refkey{/handlers/.install @@ -5016,7 +5019,7 @@ \subsubsection{Using package CollArgs} when given by the user via key \refmmzauto{args}. \tcbinputexample{_advice-CollectArgumentsRaw}[.excerpt]{% - listing only, one file, no attachment, + listing only, no .listing, no attachment, listing options app={numbers=left, numberstyle=\tiny, numbersep=0.5em}, title={The definition of the initial collector}, } @@ -6640,7 +6643,7 @@ \subsubsection{\texorpdfstring{\hologo{TeX}}{TeX}-based extraction} type}. \tcbinputexample{tex-extraction-options}[.excerpt]{% - listing only, one file, no attachment, title={The initial value of + listing only, no .listing, no attachment, title={The initial value of \refmmz{tex extraction options}}, } @@ -6661,7 +6664,7 @@ \subsubsection{\texorpdfstring{\hologo{TeX}}{TeX}-based extraction} \docref{reg:pdfmajorversion} and \docref{reg:pdfminorversion} in \hologo{LuaTeX}. \tcbinputexample{tex-extraction-script}[.excerpt]{% - listing only, one file, title=The initial value of \refmmz{tex extraction + listing only, no .listing, title=The initial value of \refmmz{tex extraction script}, no attachment} As the value of \refmmz{tex extraction script} is fully expanded when used, @@ -8593,7 +8596,7 @@ \subsubsection{Package CollArgs} ... \end{foo} \end{tcblisting} - \tcbinputexample{_collargs-verbatim}{ + \tcbinputexample{collargs-ignore-nesting-true}{ listing only, no attachment, mark region={1}{3}, example title=\texttt{ignore nesting=true} } @@ -8629,10 +8632,10 @@ \subsubsection{Package CollArgs} environment |foo|. \begin{tcbraster} - \tcbinputexample{_collargs-ignore-other-tags}(.c1){ + \tcbinputexample{collargs-ignore-other-tags}(.c1){ listing only, no attachment, mark region={3}{3}, example title=\texttt{ignore other tags=false}} - \tcbinputexample{_collargs-ignore-other-tags}(.c2){ + \tcbinputexample{collargs-ignore-other-tags}(.c2){ listing only, no attachment, mark region={3}{5}, example title=\texttt{ignore other tags=true}} \end{tcbraster} @@ -8750,7 +8753,7 @@ \subsubsection{Package CollArgs} braces. \end{enumerate*} - \tcbinputexample{collargs-expandable-processor}{comment=\input{\examplepath.tex}} + \tcbinputexample{collargs-expandable-processor}{comment=\input{\examplepath.tex}} \end{doc} \begin{doc}[ @@ -9114,7 +9117,7 @@ \subsubsection{PGF} by many other commands and environments. \tcbinputexample{_support-pgf}[.excerpt]{% - listing only, one file, no attachment, + listing only, no .listing, no attachment, title=\hypercolor{url}{white}\PGF support, } @@ -9159,7 +9162,7 @@ \subsubsection{PGF} \refcmd{AdviceCollectTikZArguments}. \tcbinputexample{_support-tikz}[.excerpt]{% - listing only, one file, no attachment, + listing only, no .listing, no attachment, title=\hypercolor{url}{white}\TikZ support, } @@ -9174,7 +9177,7 @@ \subsubsection{Forest} specifying option \refmmzauto{args} unnecessary. \tcbinputexample{_support-forest}[.excerpt]{% - listing only, one file, no attachment, + listing only, no .listing, no attachment, title=\pkg[white]{Forest} support, }