texlive[72961] trunk: memoize (24nov24)

commits+karl at tug.org commits+karl at tug.org
Sun Nov 24 21:54:26 CET 2024


Revision: 72961
          https://tug.org/svn/texlive?view=revision&revision=72961
Author:   karl
Date:     2024-11-24 21:54:26 +0100 (Sun, 24 Nov 2024)
Log Message:
-----------
memoize (24nov24)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/memoize/memoize-clean.pl
    trunk/Build/source/texk/texlive/linked_scripts/memoize/memoize-clean.py
    trunk/Build/source/texk/texlive/linked_scripts/memoize/memoize-extract.pl
    trunk/Build/source/texk/texlive/linked_scripts/memoize/memoize-extract.py
    trunk/Master/texmf-dist/doc/generic/memoize/CHANGELOG.md
    trunk/Master/texmf-dist/doc/generic/memoize/FILES
    trunk/Master/texmf-dist/doc/generic/memoize/INSTALL.md
    trunk/Master/texmf-dist/doc/generic/memoize/examples-src.zip
    trunk/Master/texmf-dist/doc/generic/memoize/examples.zip
    trunk/Master/texmf-dist/doc/generic/memoize/memoize-clean.1.md
    trunk/Master/texmf-dist/doc/generic/memoize/memoize-code.pdf
    trunk/Master/texmf-dist/doc/generic/memoize/memoize-code.tex
    trunk/Master/texmf-dist/doc/generic/memoize/memoize-doc-common.sty
    trunk/Master/texmf-dist/doc/generic/memoize/memoize-doc.pdf
    trunk/Master/texmf-dist/doc/generic/memoize/memoize-doc.sty
    trunk/Master/texmf-dist/doc/generic/memoize/memoize-doc.tex
    trunk/Master/texmf-dist/doc/generic/memoize/memoize-extract.1.md
    trunk/Master/texmf-dist/doc/man/man1/memoize-clean.1
    trunk/Master/texmf-dist/doc/man/man1/memoize-clean.man1.pdf
    trunk/Master/texmf-dist/doc/man/man1/memoize-clean.pl.man1.pdf
    trunk/Master/texmf-dist/doc/man/man1/memoize-clean.py.man1.pdf
    trunk/Master/texmf-dist/doc/man/man1/memoize-extract.1
    trunk/Master/texmf-dist/doc/man/man1/memoize-extract.man1.pdf
    trunk/Master/texmf-dist/doc/man/man1/memoize-extract.pl.man1.pdf
    trunk/Master/texmf-dist/doc/man/man1/memoize-extract.py.man1.pdf
    trunk/Master/texmf-dist/scripts/memoize/memoize-clean.pl
    trunk/Master/texmf-dist/scripts/memoize/memoize-clean.py
    trunk/Master/texmf-dist/scripts/memoize/memoize-extract.pl
    trunk/Master/texmf-dist/scripts/memoize/memoize-extract.py
    trunk/Master/texmf-dist/source/generic/memoize/Makefile
    trunk/Master/texmf-dist/source/generic/memoize/memoize.edtx
    trunk/Master/texmf-dist/source/generic/memoize/memoize.ins
    trunk/Master/texmf-dist/tex/context/third/memoize/t-memoizable.tex
    trunk/Master/texmf-dist/tex/context/third/memoize/t-memoize.tex
    trunk/Master/texmf-dist/tex/context/third/memoize/t-nomemoize.tex
    trunk/Master/texmf-dist/tex/latex/memoize/memoizable.sty
    trunk/Master/texmf-dist/tex/latex/memoize/memoize-biblatex.code.tex
    trunk/Master/texmf-dist/tex/latex/memoize/memoize.sty
    trunk/Master/texmf-dist/tex/latex/memoize/nomemoize.sty
    trunk/Master/texmf-dist/tex/plain/memoize/memoizable.tex
    trunk/Master/texmf-dist/tex/plain/memoize/memoize.tex

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/generic/memoize/memoize-code.latexmkrc
    trunk/Master/texmf-dist/doc/generic/memoize/memoize-doc.latexmkrc
    trunk/Master/texmf-dist/source/generic/memoize/Makefile.advice
    trunk/Master/texmf-dist/source/generic/memoize/Makefile.collargs
    trunk/Master/texmf-dist/source/generic/memoize/Makefile.package
    trunk/Master/texmf-dist/source/generic/memoize/Makefile.runtimes
    trunk/Master/texmf-dist/tex/latex/memoize/memoize-beamer.code.tex

Modified: trunk/Build/source/texk/texlive/linked_scripts/memoize/memoize-clean.pl
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/memoize/memoize-clean.pl	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Build/source/texk/texlive/linked_scripts/memoize/memoize-clean.pl	2024-11-24 20:54:26 UTC (rev 72961)
@@ -19,7 +19,7 @@
 # <texmf>/doc/generic/memoize/FILES.
 
 my $PROG = 'memoize-clean.pl';
-my $VERSION = '2024/04/02 v1.3.0';
+my $VERSION = '2024/11/24 v1.4.0';
 
 use strict;
 use Getopt::Long;

Modified: trunk/Build/source/texk/texlive/linked_scripts/memoize/memoize-clean.py
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/memoize/memoize-clean.py	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Build/source/texk/texlive/linked_scripts/memoize/memoize-clean.py	2024-11-24 20:54:26 UTC (rev 72961)
@@ -18,7 +18,7 @@
 # The files belonging to this work and covered by LPPL are listed in
 # <texmf>/doc/generic/memoize/FILES.
 
-__version__ = '2024/04/02 v1.3.0'
+__version__ = '2024/11/24 v1.4.0'
 
 import argparse, re, sys, pathlib, os
 
@@ -111,8 +111,8 @@
 def populate_tbdeleted(folder, basename_prefix):
     re_aux = re.compile(
         re.escape(basename_prefix) + 
-        '[0-9A-F]{32}(?:-[0-9A-F]{32})?'
-        '(?:-[0-9]+)?(?:\.memo|(?:-[0-9]+)?\.pdf|\.log)$')
+        r'[0-9A-F]{32}(?:-[0-9A-F]{32})?'
+        r'(?:-[0-9]+)?(?:\.memo|(?:-[0-9]+)?\.pdf|\.log)$')
     try:
         for f in folder.iterdir():
             if re_aux.match(f.name) and (args.all or f not in keep):

Modified: trunk/Build/source/texk/texlive/linked_scripts/memoize/memoize-extract.pl
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/memoize/memoize-extract.pl	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Build/source/texk/texlive/linked_scripts/memoize/memoize-extract.pl	2024-11-24 20:54:26 UTC (rev 72961)
@@ -19,7 +19,7 @@
 # <texmf>/doc/generic/memoize/FILES.
 
 my $PROG = 'memoize-extract.pl';
-my $VERSION = '2024/04/02 v1.3.0';
+my $VERSION = '2024/11/24 v1.4.0';
 
 use strict;
 use File::Basename qw/basename/;

Modified: trunk/Build/source/texk/texlive/linked_scripts/memoize/memoize-extract.py
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/memoize/memoize-extract.py	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Build/source/texk/texlive/linked_scripts/memoize/memoize-extract.py	2024-11-24 20:54:26 UTC (rev 72961)
@@ -18,7 +18,7 @@
 # The files belonging to this work and covered by LPPL are listed in
 # <texmf>/doc/generic/memoize/FILES.
 
-__version__ = '2024/04/02 v1.3.0'
+__version__ = '2024/11/24 v1.4.0'
 
 import argparse, re, sys, os, subprocess, itertools, traceback, platform
 from pathlib import Path, PurePath

Modified: trunk/Master/texmf-dist/doc/generic/memoize/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/doc/generic/memoize/CHANGELOG.md	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/doc/generic/memoize/CHANGELOG.md	2024-11-24 20:54:26 UTC (rev 72961)
@@ -3,6 +3,41 @@
 For the development history, see [Memoize's GitHub
 repository](https://github.com/sasozivanovic/memoize).
 
+## 2024/11/24 v1.4.0
+
+* New features:
+  * Support Beamer modes.
+  * Support externs typeset on landscape pages.
+  * Implement `salt` and related keys (used by Beamer mode support).
+
+* Minor changes:
+  * Allow changing `prefix` in `\mmznext`.
+  * To better support user interaction with foreign package support, any
+    unknown `/mmz` keys issued in the preamble are retried at `begindocument/end`.
+
+* Bugfixes:
+  * Allow for (expandable) macros in reference keys advised by `auto/ref`.
+  * Fix a regular expression in `memoize-clean.py`.
+
+* Documentation:
+  * Improve the troubleshooting sections (2.9, 3.1).
+  * Update and rewrite installation instructions.
+  * Fix some typos and formatting issues.
+
+* Under the hood:
+  * The Beamer support code now resides in a separate file, `memoize-beamer.code.tex`.
+  * Make PGF support produce nicer cc-memos.
+	
+* Build system:
+  * A new, makefile-controlled system for compiling examples, which are now
+    compiled prior to compiling the manual.
+  * Implement a different way of automatically changing the version number in
+    the documentation.
+  * Compile the documentation through dedicated `latexmkrc` config files, using
+    an adapted `memoize_latexmkrc` example config for the manual.
+  * Partially change installation-related parts of the Makefile.
+  * Include the missing makefiles in CTAN & TDS zip files.
+
 ## 2024/04/02 v1.3.0
 
 * New defaults:

Modified: trunk/Master/texmf-dist/doc/generic/memoize/FILES
===================================================================
--- trunk/Master/texmf-dist/doc/generic/memoize/FILES	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/doc/generic/memoize/FILES	2024-11-24 20:54:26 UTC (rev 72961)
@@ -9,6 +9,7 @@
 doc/generic/memoize/INSTALL.md
 doc/generic/memoize/memoize-doc.pdf
 doc/generic/memoize/memoize-doc-common.sty
+doc/generic/memoize/memoize-code.latexmkrc
 doc/generic/memoize/memoize-code.sty
 doc/generic/memoize/yadoc.sty
 doc/generic/memoize/memoize-doc.mst
@@ -16,6 +17,7 @@
 doc/generic/memoize/memoize-code.pdf
 doc/generic/memoize/memoize-code.tex
 doc/generic/memoize/memoize-extract.1.md
+doc/generic/memoize/memoize-doc.latexmkrc
 doc/generic/memoize/CHANGELOG.md
 doc/generic/memoize/memoize-doc.tex
 doc/generic/memoize/examples.zip
@@ -27,6 +29,7 @@
 scripts/memoize/memoize-clean.py
 scripts/memoize/memoize-extract.pl
 tex/latex/memoize/memoize.sty
+tex/latex/memoize/memoize-beamer.code.tex
 tex/latex/memoize/memoizable.sty
 tex/latex/memoize/nomemoize.sty
 tex/latex/memoize/memoize-biblatex.code.tex
@@ -38,6 +41,10 @@
 tex/plain/memoize/memoizable.tex
 tex/plain/memoize/memoize.tex
 tex/generic/memoize/memoizable.code.tex
+source/generic/memoize/Makefile.advice
+source/generic/memoize/Makefile.runtimes
 source/generic/memoize/memoize.edtx
 source/generic/memoize/memoize.ins
 source/generic/memoize/Makefile
+source/generic/memoize/Makefile.package
+source/generic/memoize/Makefile.collargs

Modified: trunk/Master/texmf-dist/doc/generic/memoize/INSTALL.md
===================================================================
--- trunk/Master/texmf-dist/doc/generic/memoize/INSTALL.md	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/doc/generic/memoize/INSTALL.md	2024-11-24 20:54:26 UTC (rev 72961)
@@ -1,216 +1,178 @@
 # Installation from the TDS archive
 
-If Memoize is not (yet) offered by your TeX distribution, the easiest way to
-install it is by downloading the TDS archive `memoize.tds.zip` from [Memoize's
-CTAN page](https://ctan.org/pkg/memoize), and unpacking it into your `texmf`
-directory.  You will most likely also have to do the same for two auxiliary
-packages Memoize depends on: [Advice](https://ctan.org/pkg/advice) and
+Memoize is most probably already included in your TeX distribution, but if it
+is not, the easiest way to install it is by downloading the TDS archive
+`memoize.tds.zip` from [Memoize's CTAN page](https://ctan.org/pkg/memoize), and
+unpacking it into your `texmf` directory.  You will most likely also have to do
+the same for two auxiliary packages Memoize depends on
+[Advice](https://ctan.org/pkg/advice) and
 [CollArgs](https://ctan.org/pkg/collargs).
 
-Read on only if you have an unstoppable urge to install from source and/or
-compile the manual or the documented source code.
+The TDS archives are also available through [Memoize's GitHub
+releases](https://github.com/sasozivanovic/memoize/releases).  This is where
+you can find both the older versions of the package, and the work-in-progress
+(wip) version (if any).  Note that even though Memoize, Advice and CollArgs
+share the GitHub repository, you have to download the TDS archive for each
+package separately. Each release offers both the source code and the TDS
+archive; download the latter, it follows the naming scheme
+`memoize/advice/collargs-<date>-<version>-zip`,
+e.g. `memoize-2024-04-02-v1.3.0.zip`.
 
-# Installation from the source
 
-# Getting the sources
+# Installation from the sources
 
-There are several options:
+Read this if you want to install from source (for example, to test a
+development version of the package) and/or compile the manual or the documented
+source code.
 
-* Download and unpack the zip archive of the package from [Memoize's CTAN
-  page](https://ctan.org/pkg/memoize).
-   
-* Download and unpack the TDS archive, or copy the files from your local
-  distribution. The sources reside in `<texmf>/source/generic/memoize`.
+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`, `xargs`, `zip`, plus the TeX-specific `latexmk` and `edtx2dtx`, which
+should be included in your TeX distribution.
 
-* Clone the [GitHub repository](https://github.com/sasozivanovic/memoize).
+## For the impatient
 
-## Generating runtime files
+To download and install the files needed to use the most recent, possibly
+development version of Memoize:
 
-The easiest way to generate the runtime files is by running `make`. The
-following command will generate (i) runtime TeX files for all supported formats
-(currently: LaTeX, plain TeX and ConTeXt), and (ii) the man pages for the
-accompanying scripts:
+1. Clone the [Memoize's GitHub repository](https://github.com/sasozivanovic/memoize)
 
-```
-make runtime
-```
+		git clone git at github.com:sasozivanovic/memoize.git
 
-To only generate the runtime TeX files, execute
+2. Switch to the newly created `memoize` directory:
 
-```
-make memoize.sty
-```
+		cd memoize
 
-Alternatively, you can generate the runtime files manually.  The source of this
-package was written using [EasyDTX](https://ctan.org/pkg/easydtx).  Therefore,
-you first have to convert the `.edtx` file into a regular `.dtx`:
+3. Generate and install the runtime files:
 
-```
-edtx2dtx memoize.edtx > memoize.dtx
-```
+		make install-all-runtimes
 
-The next step is standard.  Produce the runtime files by compiling the
-installation file:
 
-```
-tex memoize.ins
-```
+## Getting the sources
+	
+You can get the sources in several ways:
 
-If you require the ConTeXt runtime, replace all instances of `\expanded` and
-`\unexpanded` in `t-memoize.tex` by `\normalexpanded` and `\normalunexpanded`,
-respectively.  One way to do this is:
+* Clone the [Memoize's GitHub repository](https://github.com/sasozivanovic/memoize).
+  
+		git clone git at github.com:sasozivanovic/memoize.git
 
-```
-sed -i -s -e 's/\\\(un\)\?expanded/\\normal\1expanded/g;' t-memoize.tex
-```
+  Branch `main`, which is checked out by default, might contain work in
+  progress.  To check out an older version, execute `git checkout <tag>`, for
+  example:
 
-The man pages are produced by converting their MarkDown sources by `pandoc`
-(execute this in the `doc` subdirectory):
+		git checkout memoize-1.4.0
+	
+  For the list of tags, execute `git tag`, or visit [the list on
+  GitHub](https://github.com/sasozivanovic/memoize/tags).  Note that the
+  installation instructions below only work for Memoize versions >= 1.4.0.
 
-```
-pandoc memoize-extract.1.md -s -t man -o memoize-extract.1
-pandoc memoize-clean.1.md -s -t man -o memoize-clean.1
-```
+* Download a *source code* archive of a
+  [release](https://github.com/sasozivanovic/memoize/releases) on GitHub.
 
-Additionally, links from `memoize-x.pl.1` and `memoize-x.py.1` to `memoize-x.1`
-can be created by:
+* Download the zip archive of the package from [Memoize's CTAN
+  page](https://ctan.org/pkg/memoize).  Depending on what you want to produce,
+  you might also have to download the zip archives of packages
+  [Advice](https://ctan.org/pkg/advice) and
+  [CollArgs](https://ctan.org/pkg/collargs).  Note that the contents of
+  directories `memoize`, `advice` and `collargs` within the respective zip
+  archives have to be merged into one and the same directory.
 
-```
-echo .so man1/memoize-extract.1 > memoize-extract.pl.1
-echo .so man1/memoize-extract.1 > memoize-extract.py.1
-echo .so man1/memoize-clean.1 > memoize-clean.pl.1
-echo .so man1/memoize-clean.1 > memoize-clean.py.1
-```
+In principle, you could also get the sources from TDS archive(s), but this is
+not recommended, as you would need to move the files around after unpacking, to
+arrive at the directory structure from GitHub / CTAN zip archive.
 
-## Installation
+## Generating and installing the runtime files
 
-It is recommended to install the files into a TDS-compliant `texmf` directory,
-as usual.  Inspect file `FILES` or the TDS archive `memoize.tds.zip` to see
-what goes where.
+The runtimes can be generated and installed using `make`. To generate and
+install runtimes for Memoize, Advice and CollArgs in one go, execute
 
-Next, the scripts residing in `<texmf>/scripts/memoize` should be linked into
-some directory listed in the executable search `PATH`.  The scripts are the
-following:
+	make install-all-runtimes
 
-* `memoize-extract.pl`
-* `memoize-extract.py`
-* `memoize-clean.pl`
-* `memoize-clean.py`
+In more detail, the following targets are available. 
 
-If you have downloaded the sources from GitHub, you can build the TDS
-directories/archives of both Memoize and its auxiliary packages Advice and
-CollArgs by issuing
+* `runtimes` and `all-runtimes`: generate the runtime files
 
-```
-make
-```
+* `install-runtimes` and `install-all-runtimes`: (generate and) install the
+  runtime files
 
-This command creates: 
+* `uninstall-runtimes` and `uninstall-all-runtimes`: uninstall the runtime files
 
-* TDS directories `memoize.tds`, `advice.tds` and `collargs.tds`,
+* `link-runtimes` and `link-all-runtimes`: (generate and) install the runtime
+  files by soft-linking rather than copying
 
-* CTAN directories `ctan/memoize`, `ctan/advice` and `ctan/memoize`,
+The `all` variants perform the action for all three packages (Memoize, Advice
+and CollArgs), while the plain variants (without `all`) are limited to Memoize.
+To perform an action only for Advice or Collargs, use the plain target but
+specify the relevant Makefile (`Makefile.advice` or `Makefile.collargs`), e.g.
 
-* TDS archives `memoize.tds.zip`, `advice.tds.zip` and `collargs.tds.zip`
-  inside the CTAN directories, and 
-  
-* CTAN archives `memoize.zip`, `advice.zip` and `collargs.zip` inside directory
-  `ctan`.
-  
-The plain `make` shown above will also attempt to compile the documentation.
-If you're not ready for that (yet), you can avoid that by executing this
-instead:
+	make -f Makefile.advice install-runtimes
 
-```
-make PDF=
-```
+By default, the runtime files are installed to (or uninstalled from) the user
+`texmf` directory, as returned by `kpsewhich -var-value TEXMFHOME`.  To
+(un)install into another directory, append `TEXMFHOME=<dir>` to the invocation
+of `make`, e.g.
 
-# Compiling the documentation
+	make install-runtimes TEXMFHOME=/home/user/my-texmf-directory
 
-Compiling both the documented code listing and the manual requires a Unix-like
-operating system.  I have developed Memoize on Linux, but the documentation
-should also be compilable under Cygwin on Windows (not tested).
 
+## Compiling the documentation
+
 The documentation of Advice and CollArgs, both their manuals and documented
-code listings, is included within Memoize's documentation.
+code listings, is included within Memoize's documentation.  The documentation
+is compiled with LuaLaTeX.
 
-## Getting the source
+To compile the documented code listing:
 
-In principle, the options are the same as for the installation from the source,
-but the GitHub option is strongly preferred here, as the other two options
-require manually copying the sources of Advice and CollArgs into the Memoize
-directory.  That said:
+	make doc/memoize-code.pdf
+	
+To compile the manual:
 
-* Clone the [GitHub repository](https://github.com/sasozivanovic/memoize).
-  You're done.
+	make doc/memoize-doc.pdf
 
-* Download and unpack the zip archives of all three packages from their CTAN
-  pages: https://ctan.org/pkg/memoize, https://ctan.org/pkg/advice and
-  https://ctan.org/pkg/collargs.
-   
-  Copy `advice.edtx` and `collargs.edtx` into the Memoize directory, alongside
-  `memoize.edtx`.
-   
-* From TDS archives (of all three packages), or your local distribution's
-  `<texmf>` folder.  This is not straightforward:
-  
-  1. Make a local copy of directory `<texmf>/source/generic/memoize`; we'll
-     call it "the Memoize directory".
-	 
-  2. Copy directory `<texmf>/doc/generic/memoize` into the the Memoize
-     directory as `doc`.
-	 
-  3. Copy `memoize-extract.pl`, `memoize-extract.py`, `memoize-clean.pl` and
-     `memoize-clean.py` from directory `<texmf>/scripts` into the Memoize
-     directory.
-  
-  4. Copy `advice.edtx` from `<texmf>/source/generic/advice` and
-     `collargs.edtx` from `<texmf>/source/generic/collargs` into the the
-     Memoize directory.
+Note that the compilation of the manual takes a while, and is preceded by the
+compilation of the examples, which can be triggered separately by 
 
-## Compiling the documented code listing
+	make -C doc/examples
 
-I have compiled the code docs with LuaLaTeX on a Linux system with
-TeXLive 2023.  If you have `make`, the easiest way to compile them is by
-issuing
+By default, the manual is compiled with memoization disabled.  To enable it,
+change `\usepackage{nomemoize}` in `doc/memoize-doc.tex` to
+`\usepackage{memoize}`.
 
-```
-make doc/memoize-code.pdf
-```
 
-Alternatively, you can use `latexmk`, but you first have to convert the `.edtx`
-sources of all three packages into `.dtx`, if you haven't done so yet:
+## Building the releases
 
-```
-edtx2dtx memoize.edtx > memoize.dtx
-edtx2dtx advice.edtx > advice.dtx
-edtx2dtx collargs.edtx > collargs.dtx
-```
+How do I build the CTAN release files?  First, I change the values of variables
+`VERSION`, `YEAR`, `MONTH` and `DAY` in `Makefile` (for Memoize),
+`Makefile.advice` and `Makefile.collargs`.  Then, I execute
 
-Then, you can execute `latexmk` from the `doc` subdirectory:
+	make version
 
-```
-latexmk -lualatex -bibtex memoize-code
-```
+which updates the version information in the source code, the scripts, the
+documentation, the changelog and the manual pages.  I next perform a sanity
+check:
 
-To compile the code docs manually, three iterations of `lualatex memoize-code`
-with `makeindex -s gind.ist memoize-code.idx` between them should suffice.
+	make versions-show
 
-## Compiling the manual
+Finally, I build the CTAN release archives for all three packages, complete
+with the TDS archives, by executing:
 
-I have compiled the manual with LuaLaTeX on a Linux system with TeXLive 2023,
-`make`, `latexmk`, `perl` and `sed` installed.  Furthermore, you absolutely
-have to run the compilation with some form of `--shell-escape`, as it executes
-`make` and `sed` to build the examples.  (There is no way to compile these from
-the command line, as the instructions are baked into the manual source.)
+	make
 
-Given all this, either of the following should do the trick:
+This command creates: 
 
-* `make doc/memoize.pdf` from the Memoize directory;
+* TDS directories `memoize.tds`, `advice.tds` and `collargs.tds`,
 
-* `latexmk -lualatex -bibtex memoize` for the `doc` subdirectory; or
+* CTAN directories `ctan/memoize`, `ctan/advice` and `ctan/memoize`,
 
-* quite a few runs of `lualatex memoize` interspersed by `makeindex memoize.idx`.
-	
-If all worked well, you can change `\usepackage{nomemoize}` in
-`doc/memoize.tex` to `\usepackage{memoize}` and observe Memoize at work.
+* TDS archives `memoize.tds.zip`, `advice.tds.zip` and `collargs.tds.zip`
+  inside the CTAN directories, and 
+  
+* CTAN archives `memoize.zip`, `advice.zip` and `collargs.zip` inside directory
+  `ctan`.
+
+Invoking the plain `make` also compiles the documentation. This can
+be avoided by executing 
+
+	make PDF=

Modified: trunk/Master/texmf-dist/doc/generic/memoize/examples-src.zip
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/generic/memoize/examples.zip
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/generic/memoize/memoize-clean.1.md
===================================================================
--- trunk/Master/texmf-dist/doc/generic/memoize/memoize-clean.1.md	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/doc/generic/memoize/memoize-clean.1.md	2024-11-24 20:54:26 UTC (rev 72961)
@@ -2,8 +2,8 @@
 title: memoize-clean
 section: 1
 header: User Manual
-footer: memoize-clean of Memoize v1.3.0
-date: April 02, 2024
+footer: memoize-clean of Memoize v1.4.0
+date: November 24, 2024
 hyphenate: false
 ---
 

Added: trunk/Master/texmf-dist/doc/generic/memoize/memoize-code.latexmkrc
===================================================================
--- trunk/Master/texmf-dist/doc/generic/memoize/memoize-code.latexmkrc	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/generic/memoize/memoize-code.latexmkrc	2024-11-24 20:54:26 UTC (rev 72961)
@@ -0,0 +1,6 @@
+$pdf_mode = 1;
+$pdflatex = "lualatex %O %S";
+$bibtex = 0;
+$makeindex = "makeindex -s gind.ist %S";
+$do_cd = 1;
+$silent = 1;

Modified: trunk/Master/texmf-dist/doc/generic/memoize/memoize-code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/generic/memoize/memoize-code.tex
===================================================================
--- trunk/Master/texmf-dist/doc/generic/memoize/memoize-code.tex	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/doc/generic/memoize/memoize-code.tex	2024-11-24 20:54:26 UTC (rev 72961)
@@ -15,7 +15,7 @@
 
 \usepackage{memoize-code} % Also loads memoize-doc-common
 
-\pdfsystem{makeindex -s gind.ist \jobname.idx}
+%\pdfsystem{makeindex -s gind.ist \jobname.idx}
 
 \CodelineIndex
 \EnableCrossrefs
@@ -25,15 +25,27 @@
   \emailsymbol~\url(mailto:){saso.zivanovic at guest.arnes.si}\\
   \homepagesymbol~\url(http://){spj.ff.uni-lj.si/zivanovic}\\
   \faGithub~\url(https://){github.com/sasozivanovic}}
+\packageversion{%
+  \ParseProvidesPackage
+  \ProvidesPackage{memoize}[2024/11/24 v1.4.0 Fast and flexible externalization]
+  \begin{tabular}{c}
+    Memoize v\packagever\\
+    \csuse{@date}
+  \end{tabular}
+  \ParseProvidesPackage
+  \ProvidesPackage{advice}[2024/03/15 v1.1.1 Extend commands and environments]
+  \begin{tabular}{c}
+    Advice v\packagever\\
+    \csuse{@date}
+  \end{tabular}
+  \ParseProvidesPackage
+  \ProvidesPackage{collargs}[2024/03/15 v1.2.0 Collect arguments of any command]
+  \begin{tabular}{c}
+    Collargs v\packagever\\
+    \csuse{@date}
+  \end{tabular}
+}
 
-\datefrompackageversion{collargs}
-\edef\allpackagever{CollArgs v\packagever}
-\datefrompackageversion{advice}
-\epreto\allpackagever{Advice v\packagever, }
-\datefrompackageversion{memoize}
-\epreto\allpackagever{Memoize v\packagever, }
-\let\packagever\allpackagever
-
 \hypersetup{
   % pdftitle={Memoize},
   pdfauthor={Sašo Živanović},

Modified: trunk/Master/texmf-dist/doc/generic/memoize/memoize-doc-common.sty
===================================================================
--- trunk/Master/texmf-dist/doc/generic/memoize/memoize-doc-common.sty	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/doc/generic/memoize/memoize-doc-common.sty	2024-11-24 20:54:26 UTC (rev 72961)
@@ -48,22 +48,14 @@
 \usepackage{pdftexcmds}
 \let\pdfsystem\pdf at system
 
-% version and date
-\def\datefrompackageversion#1{%
-  \setbox0=\hbox{%
-    \def\ProvidesPackage##1[##2]{%
-      \gdef\@packagever{##2}%
-      \endinput
-    }%
-    \input{#1.sty}%
-  }%
-  \expandafter\parsepackagever@\@packagever\parsepackagever@
+\def\ParseProvidesPackage\ProvidesPackage#1[#2/#3/#4 v#5 #6]{%
+  \def\packagename{#1}%
+  \year=#2\relax\month=#3\relax\day=#4\relax
+  \def\packagever{#5}\def\packagedesc{#6}%
+  \ignorespaces
 }
-\def\parsepackagever@#1/#2/#3 v#4 #5\parsepackagever@{%
-  \year=#1\relax\month=#2\relax\day=#3\relax
-  \def\packagever{#4}\def\packagedesc{#5}%
-}
 
+\newcommand\packageversion{\def\@packageversion}
 \renewcommand\maketitle{%
   \begingroup
   \mmzset{disable, auto={tcolorbox}{clear options}}% \mmznext does not work here -- todo: maybe it does now
@@ -76,8 +68,7 @@
       tikznode lower,
       adjusted title=\@title,
     ]
-    \packagever\\
-    \@date
+    \@packageversion
     \tcblower
     \Large\@author
   \end{tcolorbox}
@@ -149,6 +140,19 @@
     {http://mirrors.ctan.org/graphics/pgf/base/doc/pgfmanual.pdf}
     {\S#1 of the Ti\emph{k}Z \& \textsc{PGF} manual}%
 }
+\newcommand\ManualBeamer[1][]{%
+  \href
+    {http://mirrors.ctan.org/macros/latex/contrib/beamer/doc/beameruserguide.pdf}
+    {#1\ifstrempty{#1}{}{ }the Beamer manual}%
+}
+\newcommand\TeXbyTopic[1][]{%
+  \href
+    {http://mirrors.ctan.org/info/texbytopic/TeXbyTopic.pdf}
+    {TeX by Topic\ifstrempty{#1}{}{, #1}}%
+}
+\newcommand\TeXbook[1][]{%
+  \hologo{TeX}book\ifstrempty{#1}{}{, #1}%
+}
 \newcommand\Alt{\,$\vert$\,}
 \newcommand\hyp{\discretionary{}{}{}}
 \newcommand\fncomma{\ensuremath{{^,}}}
@@ -169,3 +173,5 @@
 \NewDocumentCommand\pkg{O{\pkgcolor}m}{{%
     \hypercolor{url}{#1}%
     \href{https://ctan.org/pkg/#2}{\texttt{#2}}}}
+
+\NewDocumentCommand\Href{O{Hyperlink}mm}{{\hypercolor{url}{#1}\href{#2}{#3}}}
\ No newline at end of file

Added: trunk/Master/texmf-dist/doc/generic/memoize/memoize-doc.latexmkrc
===================================================================
--- trunk/Master/texmf-dist/doc/generic/memoize/memoize-doc.latexmkrc	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/generic/memoize/memoize-doc.latexmkrc	2024-11-24 20:54:26 UTC (rev 72961)
@@ -0,0 +1,276 @@
+$pdf_mode = 1;
+$pdflatex = "lualatex %O %S";
+$bibtex = 0;
+$do_cd = 1;
+$silent = 1;
+$max_repeat = 6; # we need six cycles for a fresh compilation with memoization
+
+push @generated_exts, "cpt";
+push @generated_exts, "mmz";
+push @generated_exts, "memo";
+push @generated_exts, "listing";
+
+######################################################################
+### from <texmf>/doc/support/latexmk/example_rcfiles/memoize_latexmkrc
+### with partially silenced output and
+### memoize-extract.pl --> memoize-extract.py, because the perl-based
+### extraction chokes on some externs.
+
+#print "============= I am memoize's latexmkrc.  John Collins 2024-03-29\n";
+
+# This rc file shows how to use latexmk with the memoize package.
+#
+# The memoize package (https://www.ctan.org/pkg/memoize) implements
+# externalization and memoization of sections of code in a TeX document.
+# It allows the compilation of the document to reuse results of
+# compilation-intensive code, with a consequent speeding up of runs of
+# *latex.  Such compilation intensive code is commonly encountered, for
+# example, in making pictures by TikZ.
+#
+# When a section of code to be memoized is encountered, an extra page is
+# inserted in the document's pdf file containing the results of the
+# compilation of the section of code. Then a script, memoize-extract.pl or
+# memoize-extract.py, is run to extract the extra parts of the the
+# document's pdf file to individual pdf files (called externs).  On the
+# next compilation by *latex, those generated pdf files are used in place
+# of actually compiling the corresponding code (unless the section of code
+# has changed).
+#
+# This latexmkrc file supports this process by configuring latexmk so that
+# when a compilation by *latex is done, a memoize-extract script is run
+# immediately afterwards.  If any new externs are generated, latexmk
+# notices that and triggers a new compilation, as part of its normal mode
+# of operation.
+#
+# The memoize package itself also runs memoize-extract at the start of each
+# compilation. If latexmk has already run memoize-extract, that extra run
+# of memoize-extract finds that it has nothing to do.  The solution here is
+# more general: (a) It handles the case where the memoize package is
+# invoked in the .tex file with the external=no option.  (b) It handles the
+# situation where the aux and out directories are different, which is not
+# the case for the built-in invocation.  (c) It nicely matches with
+# latexmk's general methods of determining how many runs of *latex are
+# needed.
+#
+#  Needs latexmk v. >= 4.84, memoize >= 1.2.0 (2024/03/15).
+#  TeX Live 2024 (or later, presumably).
+#  Tested on TeX Live 2024 on macOS, Ubuntu, Windows,
+#      with pdflatex, lualatex, and xelatex.
+#  Needs perl module PDF::API2 to be installed.
+#  On TeXLive on Windows, also put
+#      TEXLIVE_WINDOWS_TRY_EXTERNAL_PERL = 1
+#  in the texmf.cnf file in the root directory of the TeX Live installation.
+
+# ==> However, there are some anomalies on Windows, which haven't been sorted out
+#     yet.  These notably concern memoize-clean
+#
+# ==> Fails on MiKTeX on Windows: memoize-extract refuses to create pdf file????
+#            I haven't yet figured out the problem.
+# ==> Also trouble on MiKTeX on macOS: the memoize-extract.pl.exe won't run.
+
+# You can have separate build and output directories, e.g., by
+    #$out_dir = 'output';
+    #$aux_dir = 'build';
+# or they can be the same, e.g., by
+     # $out_dir = $aux_dir = 'output';
+
+
+# Which program and extra options to use for memoize-extract and memoize-clean.
+# Note that these are arrays, not simple strings.
+our @memoize_extract = ( 'memoize-extract.py' );
+our @memoize_clean = ( 'memoize-clean.py' );
+
+# Specification of the basic memoize files to delete in a clean-up
+# operation. The generated .memo and .pdf files have more specifications,
+# and we use memoize-clean to delete those, invoked by a cleanup hook.
+push @generated_exts, 'mmz', 'mmz.log';
+
+# Subroutine mmz_analyzes analyzes .mmz file, if it exists **and** was
+# generated in current compilation, to determine whether there are new
+# extern pdfs to be generated from memo files and pdf file.  Communicate
+# to subtroutine mmz_extract_new a need to make new externs by setting the
+# variable to a non-zero value for $mmz_has_new.  Let the value be the
+# name of the mmz file; this is perhaps being too elaborate, since the
+# standard name of the mmz file can be determined
+
+add_hook( 'after_xlatex_analysis', \&mmz_analyze );
+add_hook( 'after_main_pdf', \&mmz_extract_new );
+
+# !!!!!!!!!!!!!!!!!!!! Uncomment the following line **only** if you really
+# want latexmk's cleanup operations to delete Memoize's memoization
+# files. In a document where these files are time-consuming to make, i.e.,
+# in the main use case for the memoize package, the files are precious and
+# should only need deleted when that is really needed. 
+#
+# add_hook( 'cleanup', \&mmz_cleanup );
+
+# Whether there are new externs to be made:
+my $mmz_has_new = '';
+#     Scope of this variable: private, from here to end of file.
+
+
+#-----------------------------------------------------
+
+sub mmz_analyze {
+    use strict;
+    #print "============= I am mmz_analyze \n";
+    #print "  Still to deal with provoking of rerun if directory made\n";
+
+    # Analyzes mmz file if generated on this run.
+    # Then 1. Arranges to trigger making of missing extern pdfs, if needed.
+    #      2. Sets dependencies on the extern pdfs. This ensures that, in
+    #         the case that one or more extern pdfs does not currently
+    #         exist, a rerun of *latex will triggered after it/they get
+    #         made. 
+    # Return zero on success (or nothing to do), and non-zero otherwise.
+
+    # N.B. Current (2024-03-11) hook implementation doesn't use return
+    #      values from hook subroutines. Future implementation might.
+    #      So I'll provide a return value.
+
+    my $base = $$Pbase;
+    my $mmz_file = "$aux_dir1$base.mmz";
+
+    # Communicate to subroutine mmz_extract_new about whether new extern
+    #   pdf(s) are to be made.  Default to assuming no externs are to be
+    #   made:
+    $mmz_has_new = '';
+    
+    if (! -e $mmz_file) {
+        #print "mmz_analyze: No mmz file '$mmz_file', so memoize is not being used.\n";
+        return 0;
+    }
+
+    # Use (not-currently-documented) latexmk subroutine to detemine 
+    #   whether mmz file was generated in current run: 
+    if ( ! test_gen_file_time( $mmz_file) ) {
+        warn "mmz_analyze: Mmz file '$mmz_file' exists, but wasn't generated\n",
+             "  on this run so memoize is not **currently** being used.\n";
+        return 0;
+    }
+
+    # Get dependency information.
+    # We need to cause not-yet-made extern pdfs to be trated as source
+    # files for *latex.
+    my $mmz_fh = undef;
+    if (! open( $mmz_fh, '<', $mmz_file ) ) {
+        warn "mmz_analyze: Mmz file '$mmz_file' exists, but I can't read it:\n",
+        "  $!\n";
+        return 1;
+    }
+    my @externs = ();
+    my @dirs = ();
+    while ( <$mmz_fh> ) {
+         s/\s*$//;           # Remove trailing space, including new lines
+         if ( /^\\mmzNewExtern\s+{([^}]+)}/ ) {
+             # We have a new memo item without a corresponding pdf file.
+             # It will be put in the aux directory. 
+             my $file = "$aux_dir1$1";
+             #print "mmz_analyze: new extern for memoize: '$file'\n";
+             push @externs, $file;
+         }
+         elsif ( /^\\mmzPrefix\s+{([^}]+)}/ ) {
+             # Prefix.
+             my $prefix = $1;
+             if ( $prefix =~ m{^(.*)/[^/]*} ) {
+                 my $dir = $1;
+                 push @dirs, "$aux_dir1$1";
+
+             }
+         }
+    }
+    close $mmz_fh;
+    foreach (@dirs) {
+        if ( ! -e ) {
+            my @cmd = ( @memoize_extract, '--mkdir', $_ ); 
+            print "mmz_analyze: Making directory '$_' safely by running\n",
+                  " @cmd\n";
+            mkdir $_;
+        }        
+    }
+
+    rdb_ensure_files_here( @externs );
+    
+    # .mmz.log is read by Memoize package after it does an internal
+    # extract, so it appears as an INPUT file in .fls.  But it was created
+    # earlier in the same run by memoize-extract, so it's not a true
+    # dependency, and should be removed from the list of source files:
+    rdb_remove_files( $rule, "$mmz_file.log" );
+
+    if (@externs ) {
+        $mmz_has_new = $mmz_file;
+    }
+    return 0; 
+}
+
+#-----------------------------------------------------
+
+sub mmz_extract_new {
+    use strict;
+    #print "============= I am mmz_extract_new \n";
+
+    # If there are new extern pdf files to be made, run memoize-extract to
+    #    make them.
+    # Situation on entry:
+    #   1. I'm in the context of a rule for making the document's pdf file.
+    #      When new extern pdf files are to be made, the document's pdf
+    #      file contains the pages to be extracted by memoize-extract.
+    #      Given the rule context, the name of the document's pdf file is
+    #      $$Pdest.
+    #   2. $mmz_has_new was earlier set to the name of the mmz file with
+    #      the information on the files used for memoization, but only if
+    #      there are new extern pdf(s) to be made.
+    #   3. If it is empty, then no extern pdfs are to be made.  This covers
+    #      the case that the memoize package isn't being used.
+    # Return zero on success (or nothing to do), and non-zero otherwise.
+    
+    if ( $mmz_has_new eq '' ) { return 0; }
+
+    my $mmz_file = $mmz_has_new;
+    my ($mmz_file_no_path, $path) = fileparse( $mmz_file );
+    my $pdf_file = $$Pdest;
+
+    # The directory used by memoize-extract for putting the generated
+    #   extern pdfs is passed in the TEXMF_OUTPUT_DIRECTORY environment
+    #   variable.  (The need for this way of passing information is
+    #   associated with some security restrictions that apply when
+    #   memoize-extract is called directly from the memoize package in a
+    #   *latex compilation.)  
+    local $ENV{TEXMF_OUTPUT_DIRECTORY} = $aux_dir;
+    for ('TEXMF_OUTPUT_DIRECTORY') {
+        print "mmz_extract_new : ENV{$_} = '$ENV{$_}'\n";
+    }
+    # So we should give the name of the mmz_file to memoize-extract without
+    #   the directory part.    
+    my @cmd = (@memoize_extract, '--format', 'latex',
+                    '--pdf', $pdf_file, $mmz_file_no_path ); 
+
+    if ( ! -e $pdf_file ) {
+        warn "mmz_extract_new: Cannot generate externs here, since no pdf file generated\n";
+        return 1;
+    }
+    elsif ( ! test_gen_file($pdf_file) ) {
+        warn "mmz_extract_new: Pdf file '$pdf_file' exists, but wasn't\n",
+             "  generated on this run.  I'll run memoize-extract.  Pdf file may contain\n",
+             "  extra pages generated by the memoize package.\n";
+        return 1;
+    }
+    print "make_extract_new: Running\n @cmd\n";
+    return system @cmd;
+}
+
+#-----------------------------------------------------
+
+sub mmz_cleanup {
+    use strict;
+    print "============= I am mmz_cleanup \n";
+    my @cmd = ( @memoize_clean, '--all', '--yes',
+                      '--prefix', $aux_dir, 
+                      "$aux_dir1$$Pbase.mmz" );
+    print "mmz_cleanup: Running\n @cmd\n";
+    my $ret = system @cmd;
+    say "Return code $ret";
+    return $ret;
+}
+
+#-----------------------------------------------------

Modified: trunk/Master/texmf-dist/doc/generic/memoize/memoize-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/generic/memoize/memoize-doc.sty
===================================================================
--- trunk/Master/texmf-dist/doc/generic/memoize/memoize-doc.sty	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/doc/generic/memoize/memoize-doc.sty	2024-11-24 20:54:26 UTC (rev 72961)
@@ -56,6 +56,9 @@
   % The following doesn't work perfectly, but it's good enough.
   auto key={/tcb/breakable}{run if memoizing, outer handler=\makeunmemoizableunless{false}},
   auto key={/tcb/float}{run if memoizing, outer handler=\makeunmemoizableunless{}},
+  auto=\Emph{nomemoize,args=m}, % why do I need to specify args?
+  auto=\EmphTT{nomemoize,args=m},
+  auto=\EmphVerbatim{nomemoize,args=v},
 }
 
 \def\makeunmemoizableunless#1#2\pgfeov{%
@@ -191,15 +194,11 @@
     },
   },
 }
-\def\examplepdfpath{\examplepath.c1.pdf}
-\NewDocumentCommand{\includeexamplepdf}{ O{} O{\examplepdfpath} D(){} m}{%
+\NewDocumentCommand{\includeexamplepdf}{ O{} O{\examplename} D(){\exampledotc} m}{%
   \mbox{%
-    \tcbincludegraphics[reset,capture=hbox,graphics options={clip,#4},#1]{#2}#3%
+    \tcbincludegraphics[reset,capture=hbox,graphics options={clip,#4},#1]{\exampledir#2#3.pdf}%
   }%
 }%
-\def\ExampleName#1{\edef\examplename{#1}\ignorespaces}
-\def\makeexample#1{\pdfsystem{make -C \exampledir\space#1}\ignorespaces}
-% \def\makeexample#1{\pdfsystem{make -B -C \exampledir\space#1}}
 \def\examplepath{\exampledir\examplename}
 \RequirePackage{intopdf}
 \RequirePackage{fontawesome}
@@ -215,17 +214,8 @@
     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=\jobname.listing.attachment,
-  attachment name,
-  % attach example/.style={
-  %   attachment/.expanded=\examplepath.tex.work,
-  %   attachment name/.expanded=\examplename.tex,
-  %   attach,
-  % },
   attach/.style={
     overlay app={%
       \node at (frame.north east) [
@@ -232,50 +222,36 @@
         fill=white, draw=gray, thick,
         ellipse, inner xsep=-0.5mm, inner ysep=0, shift={(-2mm,-2mm)}, rotate=45,
       ]{%
-        \pdfsystem{make -f examples/Makefile \attachmentpath}%
-        \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}}
       };
     }
   },
-  excerpt/.code 2 args={%
-    \makeexample{#2.excerpt SOURCE=#1}%
-  },
 }
 \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} D(){\examplename}  O{.tex} O{.c1} +m }
+  >{\edef\ProcessedArgument} m O{.tex} D(){} +m }
 {%
+  /utils/exec={%
+    \edef\examplename{#1}%
+    \edef\exampledotc{#3}%
+  },%
   /mmz/context={dtxmd5sum=\csuse{pdf at filemdfivesum}{\exampledir#1#2.dtx}},
   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,
-  /utils/exec={\edef\examplepdfpath{\exampledir#1#3.pdf}},%
-  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,
 }
@@ -286,10 +262,10 @@
   listing and compile/.style={
     listing and comment,
     comment={%
-      \input\examplepath.tex.c#1
+      \input\examplepath.tex#1%
     }
   },
-  listing and compile/.default=1,
+  listing and compile/.default=,
 }
 
 \pgfkeys{
@@ -317,7 +293,7 @@
 \renewcommand\abstractname{\vskip-\baselineskip}
 
 % sections
-\newtcbox{\section at box}[3]{tile,before=\noindent,after=,
+\newtcbox{\section at box}[3]{/mmz/disable,tile,before=\noindent,after=,
   fontupper=\normalfont#1\bfseries,capture=minipage,
   colback=emphcolor,
   boxsep=0mm,top=#2,bottom=#2,left=\oddsidemargin+1in,right=\oddsidemargin+1in,
@@ -344,7 +320,7 @@
   \@startsection{subsubsection}{2}{\z@}%
   {-3.25ex\@plus -1ex \@minus -.2ex}{1.5ex \@plus .2ex}%
   {\section at box{}{2mm}{}}}
-\newtcbox{\paragraph at box}{tile,before=,after=,capture=hbox,
+\newtcbox{\paragraph at box}{/mmz/disable,tile,before=,after=,capture=hbox,
   fontupper=\normalfont\normalsize\bfseries\hypercolor{link}{black}\vphantom{dj},
   box align=base,
   boxsep=0mm,
@@ -420,52 +396,10 @@
 \usepackage{xstring}
 \usepackage{placeins}
 
-\NewDocumentCommand\makeexcerpt{ m O{.tex} D(){../../memoize.edtx} }{%
-  \ExampleName{#1}%
-  \makeexample{#1#2.excerpt SOURCE=#3}%
-  \ignorespaces
-}
-
-\newcommand\sed[2]{%
-  \begingroup
-  \def\cmd##1{\noexpand\\##1}%
-  \def\0{\bslash0}%
-  \def\1{\bslash1}%
-  \def\2{\bslash2}%
-  \def\3{\bslash3}%
-  \def\4{\bslash4}%
-  \def\5{\bslash5}%
-  \def\6{\bslash6}%
-  \def\7{\bslash7}%
-  \def\8{\bslash8}%
-  \def\9{\bslash9}%
-  \def~{\noexpand~}%
-  \def\n{\string\n}%
-  \def\({\bslash(}%
-  \def\){\bslash)}%
-  \let\lbrace\sedlbrace
-  \let\rbrace\sedrbrace
-  \edef\nobrace{[^\sedlbrace\sedrbrace]}
-  \edef\marg{{[^\sedrbrace]*}}%
-  \def\repeat##1{\bslash\sedlbrace##1\bslash\sedrbrace}%
-  \pdfsystem{sed -i "#1" #2}%
-  \endgroup
-}
-\begingroup
-\catcode`\(=1
-\catcode`\)=2
-\catcode`\{=12
-\catcode`\}=12
-\gdef\sedlbrace({)%
-\gdef\sedrbrace(})%
-\endgroup
-
 \usepackage{pifont}
 \newcommand\yes{{\small\ding{51}}} % pifont
 \newcommand\no{{\small\ding{55}}} % pifont
 
-%\newcommand\oarg[1]{{\ttfamily[}\meta{#1}{\ttfamily]}}
-
 \definecolor{Option}{rgb}{0.118,0.546,0.222}
 \definecolor{Definition}{rgb}{0.784,0.06,0.176}
 \definecolor{ExampleFrame}{rgb}{0.628,0.705,0.942}

Modified: trunk/Master/texmf-dist/doc/generic/memoize/memoize-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/generic/memoize/memoize-doc.tex	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/doc/generic/memoize/memoize-doc.tex	2024-11-24 20:54:26 UTC (rev 72961)
@@ -1,7 +1,8 @@
 \documentclass[a4paper,11pt]{article}
 \usepackage[margin=2cm,top=1cm,bottom=1cm,nohead,includefoot]{geometry}
 
-\usepackage{nomemoize}
+% The perl-based extraction chokes on some externs.
+\usepackage[extract=python]{nomemoize}
 \usepackage{memoize-doc}
 \mmzset{
   % recompile,
@@ -13,14 +14,16 @@
   % trace,
 }
 \def\exampledir{examples/}
+\def\attachmentsdir{examples/attachments/}
 
 \title{\pkg[white]{Memoize}}
+\ParseProvidesPackage
+\ProvidesPackage{memoize}[2024/11/24 v1.4.0 Fast and flexible externalization]
+\packageversion{v\packagever\\\csuse{@date}}
 \author{Sašo Živanović\\[2mm]
   \emailsymbol~\url(mailto:){saso.zivanovic at guest.arnes.si}\\
   \homepagesymbol~\url(http://){spj.ff.uni-lj.si/zivanovic}\\
   \faGithub~\url(https://){github.com/sasozivanovic}}
-\datefrompackageversion{memoize}
-\preto\packagever{v}
 
 \hypersetup{
   pdftitle={Memoize},
@@ -30,7 +33,7 @@
 }
 
 \usepackage{makeidx}
-\pdfsystem{makeindex -s memoize-doc.mst \jobname.idx}
+% \pdfsystem{makeindex -s memoize-doc.mst \jobname.idx}
 \makeindex
 \usepackage[hangindent=1em,justific=raggedright,font=small,totoc]{idxlayout}
 \appto\indexfont{\def\pkgcolor{gray}}
@@ -106,6 +109,11 @@
     },
     file={name=texmf.cnf},
     env={name=tcblisting, pkg=tcolorbox},
+    scope={
+      keypath=/tcb, pkg=tcolorbox,
+      key={name=breakable},
+      key={name=float},
+    },
     cmd={name=vref, pkg=varioref},
     cmd={name=cref, pkg=cleveref},
     cmd={name=crefrange, pkg=cleveref},
@@ -183,8 +191,6 @@
 
 \vfill
 
-\ExampleName{titlepage}
-\makeexample{\examplename.pdf N=2} % N=2, because we show the .mmz file later
 \begingroup
 \tcbset{page box/.style={
     box align=center,boxsep=2mm,top=0pt,bottom=0pt,left=0pt,right=0pt,
@@ -193,27 +199,27 @@
 \begin{tcboxedraster}
   [raster columns=1]
   {title=The two steps of externalization of graphics in Memoize}
-  \tcbinputexample{
+  \tcbinputexample{titlepage}{
     title=\tt doc.tex,
     listing only,
     remember as=tex,
   }
   \begin{tcolorbox}[example title=doc.pdf, no attachment, remember as=pdf1]
-    \includeexamplepdf[page box=extern1]{page=1,trim=1in 1in 1in 1in}\hfill
-    \includeexamplepdf[page box=extern2]{page=2,trim=1in 1in 1in 1in}\hfill
-    \includeexamplepdf[page box=extern3]{page=3,trim=1in 1in 1in 1in}\hfill
-    \includeexamplepdf[page box=docpage]{page=4}%
+    \includeexamplepdf[page box=extern1][titlepage](.c1){page=1,trim=1in 1in 1in 1in}\hfill
+    \includeexamplepdf[page box=extern2][titlepage](.c1){page=2,trim=1in 1in 1in 1in}\hfill
+    \includeexamplepdf[page box=extern3][titlepage](.c1){page=3,trim=1in 1in 1in 1in}\hfill
+    \includeexamplepdf[page box=docpage][titlepage](.c1){page=4}%
   \end{tcolorbox}
   \vspace{10mm}
   \begin{tcboxedraster}[raster columns=3, raster column skip=1cm]{blankest}
     \begin{tcolorbox}[example title=.pdf]\centering
-      \includeexamplepdf[page box=externfile1]{page=1,trim=1in 1in 1in 1in}\hfill
+      \includeexamplepdf[page box=externfile1][titlepage](.c1){page=1,trim=1in 1in 1in 1in}\hfill
     \end{tcolorbox}
     \begin{tcolorbox}[example title=.pdf]\centering
-      \includeexamplepdf[page box=externfile2]{page=2,trim=1in 1in 1in 1in}\hfill
+      \includeexamplepdf[page box=externfile2][titlepage](.c1){page=2,trim=1in 1in 1in 1in}\hfill
     \end{tcolorbox}
     \begin{tcolorbox}[example title=.pdf]\centering
-      \includeexamplepdf[page box=externfile3]{page=3,trim=1in 1in 1in 1in}\hfill
+      \includeexamplepdf[page box=externfile3][titlepage](.c1){page=3,trim=1in 1in 1in 1in}\hfill
     \end{tcolorbox}
   \end{tcboxedraster}
 \end{tcboxedraster}
@@ -225,7 +231,7 @@
       We all love Ti\emph{k}Zlings!
       \def\mytikzling#1#2{%
         \tcbox[blankest, baseline=1mm, remember as=used extern #1]
-        {\tikz[x=0.3cm,y=0.3cm]{#2;}}}%
+        {\tikz[x=0.3cm,y=0.3cm]{#2}}}%
       \mytikzling1{\penguin} is a penguin,
       \mytikzling2{\koala} is a koala, and
       \mytikzling3{\owl} is an owl.
@@ -237,8 +243,12 @@
 
 \begin{tcolorbox}[colback=emphcolor, fontupper=\footnotesize]
   This manual also documents packages Advice
-  ({\datefrompackageversion{advice}v\packagever}) and CollArgs
-  ({\datefrompackageversion{collargs}v\packagever}).  These are auxiliary
+  ({\ParseProvidesPackage
+    \ProvidesPackage{advice}[2024/03/15 v1.1.1 Extend commands and environments]
+    v\packagever}) and CollArgs
+  ({\ParseProvidesPackage
+    \ProvidesPackage{collargs}[2024/03/15 v1.2.0 Collect arguments of any command]
+    v\packagever}).  These are auxiliary
   packages which were developed alongside Memoize, but are distributed as
   independent packages as they might be useful outside the context of Memoize,
   as well.  See sections~\ref{sec:advice} and \ref{sec:ref:advice} for Advice, and
@@ -537,7 +547,7 @@
 ~\mmzset~{
   auto    = \qrcode{memoize, args=om},
   auto    = \mycite{cite},
-  extract = python,
+  padding = 2in,
   record  = makefile,
 }
   \end{tcblisting}
@@ -551,7 +561,7 @@
   \end{tcblisting}
   \begin{tcblisting}{listing only, bad}
 ~\mmzset~{
-  extract=tex,
+  recompile,
   no verbatim,
 
   prefix=memos/
@@ -673,9 +683,10 @@
 too much, because you will probably only want to use the user-wide config
 anyway, which might look something like this:
 
-\ExampleName{memoize}
-\makeexample{\examplename.cfg.c1}
-\tcbinputexample[.cfg]{listing only}
+\tcbinputexample{memoize-example}[.cfg]{
+  title=\tt memoize.cfg,
+  listing only
+}
 
 (The \refmmz{extract} line above ``permanently'' selects the Python-based
 internal extraction method, which uses script \refscript{memoize-extract.py}.
@@ -698,10 +709,9 @@
 \subsection{Let's see if it works!}
 \label{sec:tut:test}
 
-\ExampleName{test}
 \noprint{\refcmd{tikz}\refenv{tikzpicture}\refenv{forest}}%
 
-Take example file \texttt{\examplename.tex},\footnote{Where can you find
+Take example file \texttt{test.tex},\footnote{Where can you find
   the example files?  For one, they are integrated into this manual, so if your
   PDF viewer supports attachments, you can simply click on the paperclip icon
   on the top right of the example box (even if you're offline).  Otherwise,
@@ -733,8 +743,7 @@
   are now embedded into the main document.
 \end{itemize}
 
-\makeexample{\examplename.pdf}
-\tcbinputexample{
+\tcbinputexample{test}{
   sidebyside,
   comment={\centering
     \includeexamplepdf[extern page,left=2mm,right=2mm]{page=1,trim=1in 1in 1in 1in}\quad
@@ -776,9 +785,7 @@
 difference between the two is that the environment, but not the command,
 ignores any spaces surrounding the given code.
 
-\ExampleName{manual}
-\makeexample{\examplename.pdf}
-\tcbinputexample{
+\tcbinputexample{manual}{
   sidebyside, lefthand ratio=0.528,
   comment={\centering
     \includeexamplepdf[extern page]{page=1,trim=1in 1in 1in 1in}\hfill
@@ -800,14 +807,12 @@
 automemoization of the \cs{tikz} command, as explained at the end of
 section~\ref{sec:tut:test}), but that you want to easily memoize selected
 pictures.  You could define a memoized variant of the \cs{tikz} command, as shown
-below (and similary for the environment).  (Note the |%| comment characters in
+below (and similarly for the environment).  (Note the |%| comment characters in
 the definition of |\mmztikz|.  The definition was intentionally broken into
 several lines to remind you that the spaces around the argument of \refcmd{mmz}
 matter.)
 
-\ExampleName{mmztikz}
-\makeexample{\examplename.pdf}
-\tcbinputexample{
+\tcbinputexample{mmztikz}{
   comment={\centering
     \includeexamplepdf[extern page]{page=1,trim=1in 1in 1in 1in}
     \quad
@@ -835,9 +840,7 @@
   also offers key \refmmz{activate}, but you probably won't have to use it, as
   an \refmmz{auto} declaration automatically activates the submitted command.}
 
-\ExampleName{automemoize-environment}
-\makeexample{\examplename.pdf}
-\tcbinputexample{
+\tcbinputexample{automemoize-environment}{
   sidebyside, lefthand ratio=0.6,
   comment={\centering
     \includeexamplepdf[extern page]{page=1,trim=1in 1in 1in 1in,scale=0.8}
@@ -879,9 +882,7 @@
 takes two arguments: a bracketed optional argument, followed by a mandatory
 argument (in braces).
 
-\ExampleName{automemoize-command}
-\makeexample{\examplename.pdf}
-\tcbinputexample{
+\tcbinputexample{automemoize-command}{
   sidebyside, lefthand ratio=0.603, top=0mm,
   comment={\centering
     \includeexamplepdf[extern page]{page=1,trim=1in 1in 1in 1in}\quad
@@ -917,16 +918,14 @@
 memoization) and then change this style to set the yellow background.
 Curiously, the node will remain red.
 
-\ExampleName{recompile}
-\makeexample{\examplename.pdf N=3}
 \begin{tcbraster}[raster columns=2, raster valign=top, raster column skip=4mm]
-  \tcbinputexample{
+  \tcbinputexample{recompile}(.c1){
     after title pre={\ (version~1)},
     comment={\centering
       \includeexamplepdf[document page]{page=2}
     },
   }
-  \tcbinputexample[.tex][.c2]{
+  \tcbinputexample{recompile}(.c2){
     no attachment,
     after title pre={\ (version~2)},
     comment={\centering
@@ -947,7 +946,7 @@
 \refmmz{recompile} directive, otherwise, Memoize will produce the extern page
 again and again).
 
-\tcbinputexample[.tex][.c3]{
+\tcbinputexample{recompile}(.c3){
   no attachment,
   after title pre={\ (version~3)},
   sidebyside, lefthand ratio=0.6,
@@ -971,9 +970,7 @@
 by putting it into a \hologo{TeX} group, we can localize its effect to the
 selected pictures.
 
-\ExampleName{disable}
-\makeexample{\examplename.pdf}
-\tcbinputexample{
+\tcbinputexample{disable}{
   sidebyside, 
   lefthand ratio=0.6,
   top=0mm, % manual top, bottoms and \\[...] to fit the page
@@ -1002,20 +999,13 @@
   mark the parts of the document where memoization is \emph{disabled}.)
 \end{tcolorbox}
 
-\makeexample{disable-bad.tex.c1}
-\makeexample{disable-good.tex.c1}
-\makeexample{disable-nomemoize.tex.c1}
-\makeexample{disable-nommz.tex.c1}
-\makeexample{disable-auto-cmd.tex.c1}
-\makeexample{disable-auto-env.tex.c1}
-
 \begin{tcbraster}[raster columns=2, raster equal height=rows]
-  \tcbinputexample(disable-bad){
+  \tcbinputexample{disable-bad}{
     listing and comment, bad, mark region={4}{7},
     comment={\raggedright The upper \refcmd{mmzset}\braces{\refmmz{disable}}
       does not have the intended effect,
       i.e.\ it doesn't apply to the whole document!}}
-  \tcbinputexample(disable-good){
+  \tcbinputexample{disable-good}{
     listing and comment, mark region={4}{10},
     comment={\raggedright The upper \refcmd{mmzset}\braces{\refmmz{disable}} applies
       to the entire document, as expected.}}
@@ -1028,9 +1018,9 @@
 \refcmd{mmz}) off and on.
 
 \begin{tcbraster}[raster columns=2, raster equal height=rows]
-  \tcbinputexample(disable-nomemoize){listing and comment, mark region={2}{2},
+  \tcbinputexample{disable-nomemoize}{listing and comment, mark region={2}{2},
     comment=\raggedright Disable using the dedicated environment.}
-  \tcbinputexample(disable-nommz){listing and comment, mark region={2}{2},
+  \tcbinputexample{disable-nommz}{listing and comment, mark region={2}{2},
     comment=\raggedright Disable using the dedicated command.}
 \end{tcbraster}
 
@@ -1048,12 +1038,12 @@
 that command is normally automemoized.
 
 \begin{tcbraster}[raster columns=2, raster equal height=rows]
-  \tcbinputexample(disable-auto-cmd){
+  \tcbinputexample{disable-auto-cmd}{
     listing and comment,
     mark region={3}{3}, mark region={5}{5},
     comment=\raggedright Autodisable within a command.,
   }
-  \tcbinputexample(disable-auto-env){
+  \tcbinputexample{disable-auto-env}{
     listing and comment,
     mark region={3}{5},
     comment=\raggedright Autodisable within an environment.,
@@ -1073,11 +1063,9 @@
 work on stuff, and once I'm happy with the most recent pictures, remove
 \refmmz{readonly} from the package options for one compilation.
 
-\ExampleName{readonly}
-\makeexample{\examplename.pdf N=2}
 
 \begin{tcbraster}[raster columns=5, raster valign=top, raster column skip=4mm]
-  \tcbinputexample{
+  \tcbinputexample{readonly}(.c1){
     raster multicolumn=2,
     after title pre={\ (work in progress)},
     comment={\centering
@@ -1084,7 +1072,7 @@
       \includeexamplepdf[document page]{page=1}
     },
   }
-  \tcbinputexample[.tex][.c2]{
+  \tcbinputexample{readonly}(.c2){
     raster multicolumn=3,
     no attachment,
     title={\tt readonly.tex} (the final version),
@@ -1117,9 +1105,7 @@
 \cs{tikzset} (where key \code{emph} was defined), not \refcmd{mmzset}; see
 \PGFmanual{87} to learn about key handlers.
 
-\ExampleName{meaning-to-context}
-\makeexample{\examplename.pdf N=2}
-\tcbinputexample{
+\tcbinputexample{meaning-to-context}(.c1){
   after title pre={\ (version~1)},
   sidebyside,
   comment={\centering
@@ -1127,7 +1113,7 @@
   },
 }
 
-\tcbinputexample[.tex][.c2]{
+\tcbinputexample{meaning-to-context}(.c2){
   after title pre={\ (version~2)},
   sidebyside,
   comment={\centering
@@ -1179,13 +1165,9 @@
   accompanied by a \hologo{TeX} log file (|.log|) produced during the
   compilation that extracted the extern.}
 
-\ExampleName{clean-house}
-\makeexample{\examplename.pdf}
 {%
-  \relaxmmzcommands
-  \edef\marshal{%
-    \noexpand\def\noexpand\mynewextern\examplename
-  }\marshal.memo.dir/#1-#2.pdf\relax{%
+    \relaxmmzcommands
+  \def\mynewextern clean-house.memo.dir/#1-#2.pdf\relax{%
     \forestset{
       append={[#1.memo\vphantom{p},pointcolor,name=cmemo]},
       append={[#1-#2.memo\vphantom{p},pointcolor,name=ccmemo]},
@@ -1192,7 +1174,7 @@
       append={[#1-#2.pdf,pointcolor,name=extern]},
     }%
   }
-  \tcbinputexample{
+  \tcbinputexample{clean-house}{
     middle=1mm,
     comment={%
       \begin{tcolorbox}[reset, left=2mm, top=0mm, bottom=0mm, right=0mm,
@@ -1234,13 +1216,9 @@
 which is in effect by default since Memoize version 1.3.0.  Here's how a dirty
 house, which we can produce using key \refmmz{no memo dir}, would look like:
 
-\ExampleName{dirty-house}
-\makeexample{\examplename.pdf}
 {
   \relaxmmzcommands
-  \edef\marshal{%
-    \noexpand\def\noexpand\mynewextern\examplename
-  }\marshal.#1-#2.pdf\relax{%
+  \def\mynewextern dirty-house.#1-#2.pdf\relax{%
     \forestset{
       append={[\examplename.#1.memo\vphantom{p},pointcolor]},
       append={[\examplename.#1-#2.memo\vphantom{p},pointcolor]},
@@ -1247,7 +1225,7 @@
       append={[\examplename.#1-#2.pdf,pointcolor]},
     }%
   }
-  \tcbinputexample{
+  \tcbinputexample{dirty-house}{
     middle=1mm,
     comment={%
       \begin{tcolorbox}[reset, left=2mm, top=0mm, bottom=0mm,
@@ -1380,13 +1358,9 @@
   the auxiliary files.}  (As you can see below on the left, \meta{name} may
 contain a directory part.)
 
-\ExampleName{book}
-\makeexample{\examplename.tex.c1}
-\makeexample{chapters/chapter1.tex.c1}
-
 \begin{tcbraster}[raster columns=2, raster valign=top]
-  \tcbinputexample{listing only}
-  \tcbinputexample(chapters/chapter1){listing only}
+  \tcbinputexample{book}{listing only}
+  \tcbinputexample{chapters/chapter1}{listing only}
 \end{tcbraster}
 
 In the above example, the individual chapters reside in files stored in the
@@ -1445,8 +1419,6 @@
   \end{tcblisting}
 \end{tcboxedraster}
 
-\ExampleName{memoize.cfg._region_}
-\makeexample{\examplename.tex.c1}
 \begin{tcolorbox}[title=For \Emacs users]
   I often use this \refmmz{readonly} trick myself, but with a twist.  As an Emacs user,
   I don't use a \hologo{TeX}-based mechanism (such as the \pkg{docmute} package) to
@@ -1477,9 +1449,8 @@
     adapt the trick to use \refmmz{no memo dir} or an arbitrary
     \refmmz{prefix}.}
 
-  \tcbinputexample{
+  \tcbinputexample{memoize-region}[.cfg]{
     title=\tt memoize.cfg,
-    attachment name=memoize-region.cfg,
     listing only,
   }
 \end{tcolorbox}
@@ -1489,17 +1460,13 @@
 \label{sec:tut:beamer}
 
 Memoize ships with built-in support for the most widespread \hologo{LaTeX}
-presentation class, Beamer, in the sense that it can externalize a picture
-which changes from overlay to overlay.  Before we learn how to use that
-functionality, however, there's a peculiarity about loading Memoize in Beamer
-to address.
+presentation class, Beamer.  It allows for externalizing a picture which
+changes from overlay to overlay, or which depends on the Beamer mode.  However,
+loading Memoize in Beamer is a bit peculiar:
 
-\ExampleName{beamer}
-\makeexample{\examplename.pdf}
-
-\tcbinputexample{
+\tcbinputexample{beamer}{
   comment and listing,
-  listing options app={lastline=2},
+  listing options app={lastline=2}, % todo: firstline/lastline --> Makefile
   warning, no attachment, title=,
   % 
   comment={Beamer opens the document PDF while loading the class, while
@@ -1532,7 +1499,7 @@
   The implementation only uses Memoize's public interface, so understanding it
   should help if you need to support some other presentation package.}
 
-\tcbinputexample{
+\tcbinputexample{beamer}{
   listing options app={firstline=3},
   middle=1mm,
   comment={\def\dpwidth{0.27\linewidth}\def\epwidth{0.15\linewidth}%
@@ -1551,7 +1518,13 @@
   overlays.
 \end{tcolorbox}
 
+Similarly, the externalized picture might depend on the Beamer mode (|beamer|,
+|handout|, |trans| or |article|; for details, see \ManualBeamer[part IV of]).
+In this case, use \refmmz{beamer mode to prefix}, but note that this key must
+be invoked from \refcmd{mmzset} or \refcmd{mmznext}; it won't work if it is
+executed in the memoized code.
 
+
 \subsection{When stuff sticks out}
 \label{sec:tut:padding}
 
@@ -1573,12 +1546,9 @@
 below will fool \hologo{TeX} into thinking that the node is all there is to the
 picture, so centering will work as desired.
 
-\ExampleName{overlay}
-\makeexample{\examplename.pdf N=4}
-\tcbinputexample{
+\tcbinputexample{overlay}(.c1){
   after title pre={\ (no memoization)},
   comment={\centering
-    % \includeexamplepdf[document page]{page=1,trim=1.8in 7.4in 1.8in 1.7in}
     \includeexamplepdf[document page]{page=1}
   },
 }
@@ -1595,9 +1565,9 @@
   than the extern file.  But on the second compilation, when Memoize actually
   uses the extern, the pin disappears.}
 
-\tcbinputexample[.tex][.c2]{
+\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,
@@ -1618,9 +1588,9 @@
   would be huge, most often bigger than the document pages, and remember that
   the externs are first dumped into the document, where they can bother you.}
 
-\tcbinputexample[.tex][.c3]{
+\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
@@ -1634,11 +1604,11 @@
 if you're not bothered by a large extern, you can just use
 \Emph{\refmmz{padding}}, which sets all four sides at once.  By the way, having
 too much padding (almost) never hurts, and as you see, you can use (simple)
-arithmetics in the value of these keys.
+arithmetic in the value of these keys.
 
-\tcbinputexample[.tex][.c4]{
+\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
@@ -1656,27 +1626,32 @@
 
 
 
-\subsection{The verbatim mode}
+\subsection{When things (seem to) go wrong}
 \label{sec:tut:verbatim}
 
-Not all code will peacefully submit to memoization.  In particular, this is the
-case for environments which process the environment body verbatim (or perform
-some other kind of \refcmd{catcode} magic).  A simple environment of this kind is the
-standard \hologo{LaTeX} \refenv{verbatim}, but let us illustrate the issue with
-\refenv{tcblisting}, which typesets a code listing alongside its compiled effect.
-(This environment is defined by the |listings| library of package \pkg{tcolorbox}
-and was used extensively during the production of this manual.)  To manually
-memoize a \refenv{tcblisting} environment, we enclose it in a \refenv{memoize}
-environment with a \Emph{\refmmz{verbatim}} key in the optional argument ---
-without this key, the example below would produce nothing but
-errors.\footnote{Memoize also offers a \emph{partial} verbatim mode, triggered
-  by key \refmmz{verb}; in this mode, the braces retain their usual category
-  codes.  Also note that the effect of \refmmz{verbatim} can be ``undone'' by
-  key \refmmz{no verbatim}.}
+Not all code will peacefully submit to memoization, at least not out of the
+box.  For one, this is the case for code containing a command or environment
+which changes the category code of some character(s).  Most notably,
+\refcmd{catcode}s are changed by so-called verbatim environments like the
+standard \hologo{LaTeX} \refenv{verbatim}, but other commands and environments
+effect category code changes as well; one example is command \cs{matrix} (of
+\TikZ{} library |matrix|).  The solution is to use key
+\Emph{\refmmz{verbatim}}, which instructs Memoize to collect the code ``as-is''
+(in \hologo{TeX}nical terms, under a catcode regime where all characters have
+category code 12) and rescan it (with \cs{scantokens}) when starting the
+memoization.\footnote{Memoize also offers a \emph{partial} verbatim mode,
+  triggered by key \refmmz{verb}; in this mode, the braces retain their usual
+  category codes.  Also note that the effect of \refmmz{verbatim} can be
+  ``undone'' by key \refmmz{no verbatim}.}
 
-\ExampleName{verbatim-manual}
-\makeexample{\examplename.pdf}
-\tcbinputexample{
+Let us illustrate the issue with environment \refenv{tcblisting} (library
+|listings| of package \pkg{tcolorbox}), which typesets a code listing alongside
+its compiled effect.  To successfully manually memoize this environment, we
+have to enclose it in a \refenv{memoize} environment containing key
+\refmmz{verbatim} in the optional argument --- without
+this key, the example below would produce nothing but errors.
+
+\tcbinputexample{verbatim-manual}{
   sidebyside,
   comment={\centering
     \includeexamplepdf[extern page]{page=1,trim=1in 1in 1in 1in}\\[1ex]
@@ -1687,19 +1662,15 @@
 
 Using \refmmz{verbatim} from \refcmd{mmzset} or \refcmd{mmznext} works just as
 well, and the latter can be very useful with automemoization, when some
-environment (say, \env{tcolorbox}) generally does not require the verbatim mode,
-but a specific occurrence does (say, because it contains some verbatim
-construction such as \verb!|!\meta{verbatim text}\verb!|! of the \pkg{ltxdoc}
-class).
+environment (say, \env{tcolorbox} of package \pkg{tcolorbox}) generally does
+not require the verbatim mode, but a specific occurrence does (say, because it
+contains a verbatim construct such as \verb!|!\meta{verbatim text}\verb!|!  of
+the \pkg{ltxdoc} class).  However, for an environment such as |tcblisting|, it
+makes the most sense to declare it verbatim in general, so that all instances
+of the environment will be processed in the verbatim mode.  This is simple to
+do: add \refmmz{verbatim} to the \refmmz{auto} keylist.
 
-However, for an environment such as |tcblisting|, it makes the most sense to
-declare it verbatim in general, so that all instances of the environment will
-be processed in the verbatim mode.  This is simple to do: add \refmmz{verbatim}
-to the \refmmz{auto} keylist.
-
-\ExampleName{verbatim-auto}
-\makeexample{\examplename.pdf}
-\tcbinputexample{
+\tcbinputexample{verbatim-auto}{
   sidebyside, % lefthand ratio=0.62,
   comment={\centering
     \footnotesize
@@ -1720,7 +1691,50 @@
 section~\ref{sec:tut:automemoization-details} or looked at the Memoize's source
 code).
 
+One other situation where a piece of code cannot be memoized out of the box is
+when it is designed to operate in the vertical mode;\footnote{``Horizontal mode
+  is typically used to make lines of text; vertical mode is typically used to
+  stack the lines of a paragraph on top of each other.'' (\TeXbyTopic[\S6])}
+examples include the standard \hologo{LaTeX} \refenv{verbatim} environment
+(again) and environment \env{algorithmic} of bundle \pkg{algorithms}.  The
+problem arises because by default, Memoize collects the typeset material into a
+horizontal box (\cs{hbox}), i.e.\ in the horizontal mode (note that there is no
+way for Memoize to detect the mode required by the memoized code in advance).
+Luckily, Memoize provides an easy solution: we simply have to instruct it to
+memoize into a vertical box (\cs{vbox}), which we can achieve by writing
+\Emph{\refmmz{capture}|=|\refmmz{capture=vbox}}, exemplified below with
+environment \env{algorithmic}.\footnote{Note that this solution does not work
+  for commands and environments which operate in \emph{external} vertical mode;
+  see section~\ref{sec:limits} for details.}
 
+\tcbinputexample{capture}{
+  sidebyside, lefthand ratio=0.53, middle=0pt,
+  comment={\centering
+    \includeexamplepdf[left=0.9em, right=0.9em]{page=2}
+  }
+}
+
+\newcommand\ProblemsWithMemoization[1][above]{%
+  Some situations where memoization of otherwise healthy code produces errors
+  have easy solutions like the two presented #1.  In other situations, like
+  those listed in section~\ref{sec:limits}, memoization is genuinely
+  impossible.  Yet other situations lie somewhere in-between.  Memoization is
+  possible, but implementing it requires some work and knowledge (of the rest
+  of this manual).  To top it off, it is often hard to know which kind of
+  situation one is dealing with, not least because \hologo{TeX}'s error
+  messages can be quite uninformative on the subject.
+
+  \Href{https://github.com/sasozivanovic/memoize/wiki}{Memoize wiki} on GitHub
+  lists several commands and environments, marking the issues which they
+  present to memoization, and providing solutions where possible.  The list
+  will hopefully grow to encompass many commonly used commands, but if the
+  command you're struggling with is not there, feel free to drop me an email,
+  or (even better) post a question to
+  \Href{https://tex.stackexchange.com}{\hologo{TeX} StackExchange} (use tag
+  \texttt{memoize}).}
+
+\ProblemsWithMemoization
+
 \subsection{The final version of your document}
 \label{sec:tut:final}
 
@@ -1736,7 +1750,7 @@
 \end{itemize}
 
 Below, we list several ways of fully disabling Memoize.  You're of course
-already familar with the first two ways, but what's this \refpkg{nomemoize}
+already familiar with the first two ways, but what's this \refpkg{nomemoize}
 package?  The rationale behind this package is that if you want to be
 absolutely sure that there is no trace of memoization in your document (for
 example, see the \refmmz{disable} -- \refmmz{enable} pitfall in
@@ -1794,8 +1808,8 @@
 
 
 
-\subsection{Good to know}
-\label{sec:tut:good-to-know}
+\subsection{The limits}
+\label{sec:limits}
 
 
 \paragraph{Line- and page-breaking} An extern can't be broken across lines or
@@ -1810,26 +1824,50 @@
 --- without an error!  --- but your externalized text will end up in a single
 line, as shown below.
 
-\ExampleName{no-linebreaking}
-\makeexample{\examplename.pdf N=2}
-\tcbinputexample{
+\tcbinputexample{no-linebreaking}(.c1){
   bad,
   comment={\centering
     \includeexamplepdf[extern page,to be continued on right]
       {page=1,trim=1in 1in 14in 1in}\\[1ex]    
     \includeexamplepdf[document page]{page=2}\\[1ex]
-    \includeexamplepdf[document page,title=the expected document page]
-                      [\examplepath.c2.pdf]{page=1}
+    \includeexamplepdf[document page,title=the expected document page](.c2){page=1}
   },
 }
 
-That said, you \emph{can} externalize a paragraph or some other vertical mode
-material using \refmmz{capture}|=|\refmmz{capture=vbox}, but beware that the
-vertical spacing between the memoized material and its surroundings might
-change.
 
+\paragraph{External vertical mode}
 
-\paragraph{\env{remember picture}}
+Attempting to memoize a command or environment which operates in
+\emph{external} vertical mode (called simply ``vertical mode'' in \TeXbook)
+will fail, because Memoize can only operate in \emph{internal} vertical
+mode.\footnote{In vertical mode, \hologo{TeX} is ``building the main vertical
+  list, from which the pages of output are created'', while it is ``building a
+  vertical list for a vbox'' in internal vertical mode.  Similarly, in
+  horizontal mode, \hologo{TeX} is ``building a horizontal list for a
+  paragraph,'' while it is ``building a horizontal list for an hbox'' in
+  restricted horizontal mode.  (All quotes are from \TeXbook[85].)}
+
+At one hand, any command or environment which needs interact with the page
+breaking mechanism, like a command designed to break its output across pages,
+has to operate in external vertical mode.  An example of such an environment is
+a \env{tcolorbox} with key \refkey{/tcb/breakable} or \refkey{/tcb/float}.  On
+the other hand, Memoize can only externalize boxes, and to gather typeset
+material in a box, it needs to operate either in restricted horizontal mode (by
+default) or internal vertical mode (when asked to do so by
+\refmmz{capture}|=|\refmmz{capture=vbox}).
+
+In a nutshell, Memoize is inherently incompatible with external vertical mode.
+For example, an attempt to memoize a breakable \env{tcolorbox} will fail ---
+even if the environment ends up producing a non-broken box.  As far as I see,
+the only way to support memoization of a command which has to operate in
+external mode is from within the package defining the command; the command must
+be reimplemented in a Memoize-friendly fashion, perhaps using the ideas
+presented in sections~\ref{sec:memoizable-design}
+and~\ref{sec:memoization-complex-single-driver}.
+
+
+
+\paragraph{\refkey{/tikz/remember picture}}
 \TikZ pictures using this key cannot be externalized.
 
 Memoize will silently refuse to externalize any \TikZ picture using
@@ -1887,7 +1925,7 @@
   environment normally in your document, or when some macro expands so that it
   produces both \cs{begin}\meta{environment name} and \cs{end}\meta{environment
     name} simultaneously --- so there would be no problem above if
-  |\end{minipage}| occured in the beginning code of \env{sectionbox}.  The idiom
+  |\end{minipage}| occurred in the beginning code of \env{sectionbox}.  The idiom
 presented above is problematic for memoization because at the time \hologo{TeX}
 executes |\begin{sectionbox}|, putting |\begin{minipage}| into the input
     stream, |\end{sectionbox}| is not yet executed and remains as it is.  The
@@ -1902,8 +1940,6 @@
 "minipage" ended as "sectionbox"| error.}
 
 \begingroup
-\ExampleName{sectionbox}
-\makeexample{\examplename.tex.c1}
 \mmzset{disable}
 \begin{tcbraster}[raster equal height]
 \begin{tcblisting}{listing only, bad, valign=center}
@@ -1919,7 +1955,7 @@
   % ...
 }  
 \end{tcblisting}
-\tcbinputexample{
+\tcbinputexample{sectionbox}{
     bad,
     comment={\small\tt
       ! Package collargs Error: Environment\\"minipage" ended as "sectionbox".
@@ -2169,7 +2205,7 @@
 Out of the box, Memoize stores memos and externs in a separate directory,
 \code{\meta{document name}.memo.dir}, creating this directory if it does not
 exist.  This behaviour, illustrated in section~\ref{sec:tut:memodir}, is
-trigerred by key \refmmz{memo dir}, which is in effect by default since Memoize
+triggered by key \refmmz{memo dir}, which is in effect by default since Memoize
 version~1.3.0.
 
 It is however worth noting that something rather unusual is happening behind
@@ -2216,7 +2252,7 @@
 works with the built-in Perl).  Of course, this situation is undesirable in and
 of itself, as it forces the author to fall back to the slower
 \hologo{TeX}-based extraction by issuing
-\code{\refmmz{extract}=\refmmz{extract=tex}}, but note that it will additionaly
+\code{\refmmz{extract}=\refmmz{extract=tex}}, but note that it will additionally
 prevent the execution of the default \refmmz{mkdir command}.  Possible
 workarounds include either undoing the effect of \refmmz{memo dir} by issuing
 \refmmz{no memo dir}, or changing the \refmmz{mkdir command} to a command like
@@ -2271,8 +2307,6 @@
 in Memoize.  (The inner workings of the context are further explained in
 section~\ref{sec:c-memos}.)
 
-\ExampleName{ref}
-\makeexample{\examplename.pdf N=7}
 
 When the memoized code contains a \cs{ref} referring to a label given in another
 part of the document, the code is recompiled when (and only when) the reference
@@ -2284,7 +2318,7 @@
 externs don't disturb us, and we can focus on the \cs{tikz} command, which does
 get externalized and contains a \cs{ref}.)
 
-\tcbinputexample[.tex][.c3]{
+\tcbinputexample{ref}(.c3){
   after title pre={\ (with stable output after three compilations)},
   middle=1mm,
   comment={\centering
@@ -2297,7 +2331,7 @@
 this compilation, the new value of the penguin label only makes it into the
 |.aux| file.
 
-\tcbinputexample[.tex][.c4]{
+\tcbinputexample{ref}(.c4){
   after title pre={\ (after the first compilation with the added owl)},
   no attachment,
   comment={\centering
@@ -2310,7 +2344,7 @@
 forces recompilation of the extern (\emph{how} this is done will be explained
 later).
 
-\tcbinputexample[.tex][.c5]{
+\tcbinputexample{ref}(.c5){
   after title pre={\ (after the second compilation with the added owl)},
   comment only, no attachment,
   comment={\centering
@@ -2322,7 +2356,7 @@
 In the next compilation, the resulting PDF is finally stabilized, as the
 updated extern is (extracted and) included into the document.  
 
-\tcbinputexample[.tex][.c6]{
+\tcbinputexample{ref}(.c6){
   after title pre={\ (after the third compilation with the added owl)},
   comment only, no attachment,
   comment={\centering
@@ -2342,13 +2376,11 @@
 \refmmz{auto}, but with advice offered by \Emph{\refmmzauto{ref}} rather than
 \refmmzauto{memoize}.
 
-{\ExampleName{vref}
-\makeexample{\examplename.tex.c1}
-\tcbinputexample{listing only}}
+\tcbinputexample{vref}{listing only}
 
 Key \refmmzauto{ref} only works for commands which operate on a single
 reference key.  However, that single key (which must be enclosed in braces) may
-be preceded by optional argumen(s) of any kind.  Extensions to \refcmd{ref},
+be preceded by optional argument(s) of any kind.  Extensions to \refcmd{ref},
 e.g.\ the \pkg{hyperref}'s variant, which accepts an optional |*|, work out of
 the box.  Furthermore, Memoize offers support for cross-referencing commands
 which work on multireferences and reference ranges, such as \pkg{cleveref}'s
@@ -2366,7 +2398,7 @@
 This is so because by default, Memoize aborts a memoization containing an
 undefined reference.
 
-\tcbinputexample[.tex][.c1]{
+\tcbinputexample{ref}(.c1){
   after title pre={\ (after the fresh compilation of the original example)},
   comment only, no attachment,
   comment={\centering
@@ -2380,12 +2412,12 @@
 until then.  In that case, apply the \refmmz{auto} key \Emph{\refmmzauto{force
     ref}} to \cs{ref}.
 
-\tcbinputexample[.tex][.c7]{
+\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][\examplepath.c1.pdf]{page=1,trim=1in 1in 1in 1in}\quad
-    \includeexamplepdf[document page][\examplepath.c1.pdf]{page=2}
+    \includeexamplepdf[extern page](.c1){page=1,trim=1in 1in 1in 1in}\quad
+    \includeexamplepdf[document page](.c1){page=2}
   }
 }
 
@@ -2407,9 +2439,7 @@
 using command |\small|; changing the default size with a class option such as
 |12pt| works as well.
 
-\ExampleName{fontsize}
-\makeexample{\examplename.pdf N=2}
-\tcbinputexample{
+\tcbinputexample{fontsize}(.c1){
   sidebyside, lefthand ratio=0.7, after title pre={\ (the first version)},
   comment={
     \includeexamplepdf[extern page]{page=1,trim=1in 1in 1in 1in}
@@ -2416,7 +2446,7 @@
   }
 }
 
-\tcbinputexample[.tex][.c2]{
+\tcbinputexample{fontsize}(.c2){
   sidebyside, lefthand ratio=0.7, after title pre={\ (the second version)},
   no attachment,
   comment={
@@ -2477,9 +2507,7 @@
 context: we dig into the \pkg{skak} sources and realize that the current
 board is stored in macro |\csname chessgame.skak.mainline\endcsname|.
 
-\ExampleName{skak}
-\makeexample{\examplename.pdf}
-\tcbinputexample{
+\tcbinputexample{skak}{
   sidebyside, lefthand ratio=0.48,
   comment={
     \includeexamplepdf[extern page]{page=1,trim=1in 1in 1in 1in,scale=0.45}\quad
@@ -2506,37 +2534,35 @@
 the example from that section a bit further.  We will propose no new solution
 or workaround, but deepen our understanding of the issue.
 
-\ExampleName{redefinitions}
-\makeexample{\examplename.pdf N=6}
 \tcbset{
   recompile step/.style={
     sidebyside, lefthand ratio=0.74, title=,
-    comment={\includeexamplepdf[blankest][\examplepath.c\theenumi.pdf]{#1}},
+    comment={\includeexamplepdf[blankest][redefinitions](.c\theenumi){#1}},
     /utils/exec={\addtocounter{enumi}{1}},
     enhanced, overlay app={\node[at=(frame.north west), font=\scriptsize, circle, fill=black!80!white, text=white, inner sep=1pt]{\theenumi};},
   },
 }
 \begin{tcboxedraster}[raster columns=1]{%
-    title=Working on \texttt{\examplename.tex}, enhanced, breakable}
+    title=Working on \texttt{redefinitions.tex}, enhanced, breakable}
   \setcounter{enumi}{0}%
   \tcbox[blankest]{I like red. My emphasized nodes will have red background.}
-  \tcbinputexample[.tex][.c1]{recompile step={page=2}}
+  \tcbinputexample{redefinitions}(.c1){recompile step={page=2}}
   \tcbox[blankest]{Hmm, this particular node is really important,
     let me put the text in italics as well!}
-  \tcbinputexample[.tex][.c2]{recompile step={page=2}, no attachment}
+  \tcbinputexample{redefinitions}(.c2){recompile step={page=2}, no attachment}
   \tcbox[blankest]{You know what? Perhaps yellow background would work better
     --- in general.}
-  \tcbinputexample[.tex][.c3]{recompile step={page=1}, bad, no attachment}
+  \tcbinputexample{redefinitions}(.c3){recompile step={page=1}, bad, no attachment}
   \tcbox[blankest]{How come my node is still red?!  Oh yes, I changed the
     style, so I have to recompile the extern!}
-  \tcbinputexample[.tex][.c4]{recompile step={page=2}, no attachment}
+  \tcbinputexample{redefinitions}(.c4){recompile step={page=2}, no attachment}
   \tcbox[blankest]{Ahh, yellow background, that's much better.  But you know
     what, this double emphasis won't do after all, let me go back to the
     upright shape.}
-  \tcbinputexample[.tex][.c5]{recompile step={page=1}, bad, no attachment}
+  \tcbinputexample{redefinitions}(.c5){recompile step={page=1}, bad, no attachment}
   \tcbox[blankest]{Red???!???!? Ok, I know that recompiling will help, but what
     happened here?}
-  \tcbinputexample[.tex][.c6]{recompile step={page=2}, no attachment}
+  \tcbinputexample{redefinitions}(.c6){recompile step={page=2}, no attachment}
 \end{tcboxedraster}
 
 What happened is that the externs from steps~1 and~5 share the very same code.
@@ -2593,9 +2619,7 @@
 rather, the single extern --- resulting in the document containing the second
 progressbar in the place of the first one as well.
 
-\ExampleName{progressbar}
-\makeexample{\examplename.pdf N=2}
-\tcbinputexample{
+\tcbinputexample{progressbar}(.c1){
   bad, float,
   comment={
     \begin{tcbitemize}[raster columns=3,raster equal height,halign=center,valign=center]
@@ -2606,7 +2630,7 @@
       \tcbitem[title=After extern extraction\vphantom{p\textsuperscript{nd}}]
       \includeexamplepdf[my boxed title=the extern file,attach shifted boxed title to top right,remember as=externfile]{page=2,trim=1in 1in 1in 1in}
       \tcbitem[title=After 2\textsuperscript{nd} compilation]
-      \includeexamplepdf[document page,remember as=doc][\examplepath.c2.pdf]{page=1}
+      \includeexamplepdf[document page,remember as=doc](.c2){page=1}
     \end{tcbitemize}
     \begin{tikzpicture}[remember picture,overlay]
       \draw[->, thick, red] (extern1.east) to[out=east, in=west] ([yshift=0.5ex]externfile.west);
@@ -2736,10 +2760,7 @@
 contains |\centering| to center the box horizontally (centering is of course
 only observable when we change the width of the box).
 
-\ExampleName{poormansbox}
-\makeexample{\examplename.sty}
-\makeexample{\examplename.pdf}
-\tcbinputexample{
+\tcbinputexample{poormansbox}{
   sidebyside, lefthand ratio=0.482,
   comment={\centering
     \includeexamplepdf[document page,left=0pt,right=0pt]
@@ -2762,7 +2783,7 @@
 have to pay special attention to nesting (which presents no problem to the
 implementation in this section).
 
-As you can see in the package listing below (\texttt{\examplename.sty}), the
+As you can see in the package listing below (\texttt{poormansbox.sty}), the
 implementation of our environment is straightforward.  We first define the
 configuration command |\pmbset| and the option keys (we're using
 \pkg{pgfkeys}), and set the option defaults.  Then, we move on to the
@@ -2770,10 +2791,9 @@
 the box (which is a |minipage| of the given width, potentially wrapped in a
 |\fbox|), and execute the post-code.
 
-\tcbinputexample[.sty]{listing only, float}
+\tcbinputexample{poormansbox}[.sty]{listing only, float}
 
-\ExampleName{poormansbox-memoizable}
-Now let's make our |poormansbox| externalizable (\texttt{\examplename.sty}).  As
+Now let's make our |poormansbox| externalizable (\texttt{poormansbox-memoizable.sty}).  As
 announced above, the idea is to split the definition of the environment into
 the outer part (below, the user-level environment |poormansbox|), which
 (applies the options and) executes the pre- and the post-code, and the inner
@@ -2792,13 +2812,11 @@
   part of the definition as an environment (|@poormansbox|) as well, and embed
   it into the user-level environment using the following idiom:
   |\newenvironment{poormansbox}[2][]{...\begin{@poormansbox}}{\end{@poormansbox}...}|.
-  However, as illustrated in section~\ref{sec:tut:good-to-know}, automemoizing
+  However, as illustrated in section~\ref{sec:limits}, automemoizing
   an environment indirectly embedded in such a way produces an error, because
   Memoize is prevented from collecting the environment body.}
 
-\makeexample{\examplename.sty}
-\makeexample{\examplename.pdf}% just to know if it compiles fine
-\tcbinputexample[.sty]{listing only, float}
+\tcbinputexample{poormansbox-memoizable}[.sty]{listing only, float}
 
 Looking at the definition of the internal |\@poormansbox| command, it might
 strike you as weird that we have equipped this command with an optional
@@ -2849,7 +2867,7 @@
 \refcmd{mmzset} command will not work unless surrounded by |\makeatletter| and
 |\makeatother|, as it refers to an internal control sequence containing |@|.
 Well, Memoize offers \refmmz{auto csname}, \refmmz{activate csname} and
-\refmmz{deactivate csname}, so that |@| catagory code manipulations can be
+\refmmz{deactivate csname}, so that |@| category code manipulations can be
 omitted by writing \refcmd{mmzset}\bracestt{\refmmz{deactivate
     csname}|=@poormansbox|}, but still.
 
@@ -2870,25 +2888,13 @@
 least inform the author who refuses to read the fine material accompanying our
 |poormansbox| that something funky is going on.
 
-\begingroup
-\relaxmmzcommands
-\def\mmzNewCMemo#1{% fetch the last c-memo filename
-  \def\mycmemo{#1}%
-}
-\input{\examplepath.mmz.c1}
-\sed{%
-  s/[]]\lbrace/]\n\space\space\space\space\space\space\space
-           \space\space\space\space\space\space\space\lbrace/;
-}{\exampledir\mycmemo}
-\tcbinputlisting{
+\tcbinputexample{poormansbox-memoizable}[.cmemo]{
   listing only,
-  listing file=\exampledir\mycmemo,
-  example title,
   title=the c-memo of the last \texttt{poormansbox} environment,
-  left=0.5em, right=0em,
+  no attachment,
 }
-\endgroup
 
+
 In a nutshell, automemoizing an internal command might be counter-intuitive for
 the author.  But the core idea --- to support memoization of a resistant
 command by splitting its definition into the outer and the inner command --- is
@@ -2997,9 +3003,7 @@
 extern produced by \refcmd{Memoize}, in the fashion of the |progressbar|
 example from section~\ref{sec:tut:redefinitions}.
 
-\ExampleName{memoize-internal}
-\makeexample{\examplename.pdf N=2}
-\tcbinputexample{
+\tcbinputexample{memoize-internal}(.c1){
   comment={%
     \includeexamplepdf[document page,
       after title pre={\ (after the first compilation)}
@@ -3006,7 +3010,7 @@
     ]{page=3}\hfill
     \includeexamplepdf[document page,
       after title pre={\ (after the second compilation)}
-    ][\examplepath.c2.pdf]{page=1}
+    ](.c2){page=1}
   },
 }
 
@@ -3131,20 +3135,11 @@
 cc-memo (it belongs to the titlepage penguin):
 
 \begingroup
-\relaxmmzcommands
-\def\mmzNewCCMemo#1{% fetch the first cc-memo filename
-  \def\myccmemo{#1}%
-  \endinput
-}
-\input{\exampledir titlepage.mmz.c1}
-\sed{%
-  s/\cmd{quitvmode} \cmd{mmzIncludeExtern}/\cmd{quitvmode}\n\cmd{mmzIncludeExtern}/;
-  s/\(\marg\)\cmd{global}/\1\n\cmd{global}/;
-}{\exampledir\myccmemo}
-\tcbinputlisting{
+\input{\exampledir titlepage.ccmemo}% --> \mymemo
+\tcbinputexample{titlepage}[.ccmemo]{
   listing only,
-  listing file=\exampledir\myccmemo,
-  example title=\myccmemo,
+  no attachment,
+  example title=\mymemo,
 }
 \endgroup
 
@@ -3161,9 +3156,10 @@
 extern was \refmmz{capture}d into a horizontal box (which is the usual
 situation).  The second one is \refcmd{mmzIncludeExtern}, and it is this
 command which actually includes the extern into the document upon inputting the
-cc-memo. The core code is executed without introducing any groups, i.e.\ the
-effect of any local assignments in the cc-memo will persist into the code
-following the memoized code.
+cc-memo.  (The third command above, \refcmd{mmzStepPgfPictureId}, is written
+by PGF support, see section~\ref{sec:support:pgf}.) The core code is executed
+without introducing any groups, i.e.\ the effect of any local assignments in
+the cc-memo will persist into the code following the memoized code.
 
 Command \refcmd{mmzIncludeExtern} takes nine parameters.  The first is the
 sequential number of the extern associated with the cc-memo, starting with 0;
@@ -3180,16 +3176,14 @@
 \refcmd{label} to support \cs{label}s inside memoized code --- the following
 code ``just works.''
 
-\ExampleName{label}
-\makeexample{\examplename.pdf N=3}
-\tcbinputexample{
+\tcbinputexample{label}(.c1){
   comment={\centering
     \includeexamplepdf[document page, after title pre={\ (compilation 1)},
       left=1.5mm, right=1mm]{page=2}\quad
     \includeexamplepdf[document page, after title pre={\ (compilation 2)},
-      left=1.5mm, right=1mm][\examplepath.c2.pdf]{page=1}\quad
+      left=1.5mm, right=1mm](.c2){page=1}\quad
     \includeexamplepdf[document page, after title pre={\ (compilation 3)},
-      left=1.5mm, right=1mm][\examplepath.c3.pdf]{page=1}
+      left=1.5mm, right=1mm](.c3){page=1}
   },
 }
 
@@ -3223,23 +3217,11 @@
 compilation, even if the memoized code itself is not compiled.
 
 \begingroup
-\relaxmmzcommands
-\def\mmzNewCCMemo#1{% fetch the first cc-memo filename
-  \def\myccmemo{#1}%
-  \endinput
-}
-\input{\examplepath.mmz.c1}
-\sed{%
-  s/~//g;
-  s/\cmd{quitvmode} \cmd{mmzLabel}/\cmd{quitvmode}\n\cmd{mmzLabel}/;
-  s/\(\marg\)\cmd{mmzIncludeExtern}/\1\n\cmd{mmzIncludeExtern}/;
-  s/\(\cmd{mmzLabel}\) *\(\marg\marg\) */~\1\2~\space/g;
-  s/\(\marg\marg\marg\)\(\marg\marg\marg\marg\marg\)/\1\space\2/;
-}{\exampledir\myccmemo}
-\tcbinputlisting{float,
+\input{\exampledir label.ccmemo}
+\tcbinputexample{label}[.ccmemo]{float,
   listing only, right=1.5mm,
-  listing file=\exampledir\myccmemo,
-  example title=\myccmemo,
+  example title=\mymemo,
+  no attachment,
 }
 \endgroup
 
@@ -3320,16 +3302,11 @@
 will only see this once we arrive at the \pkg{beamer} example below.
 
 \begingroup
-\relaxmmzcommands
-\def\mmzNewCMemo#1{% fetch the first c-memo filename
-  \def\mycmemo{#1}%
-  \endinput
-}
-\input{\exampledir titlepage.mmz.c1}
-\tcbinputlisting{
+\input{\exampledir titlepage.cmemo}
+\tcbinputexample{titlepage}{% todo
   listing only,
-  listing file=\exampledir\mycmemo,
-  example title=\mycmemo,
+  listing file=\exampledir\mymemo,
+  example title=\mymemo,
 }
 \endgroup
 
@@ -3343,20 +3320,11 @@
 the context expression additions.
 
 \begingroup
-\relaxmmzcommands
-\def\mmzNewCMemo#1{% fetch the first c-memo filename
-  \def\mycmemo{#1}%
-  \endinput
-}
-\input{\exampledir ref.mmz.c1}
-\sed{%
-  s/~//g;
-  s/\cmd{global}.*\marg/~\0~/;
-}{\exampledir\mycmemo}
-\tcbinputlisting{
+\input{\exampledir ref.cmemo}
+\tcbinputexample{ref}[.cmemo]{
   listing only,
-  listing file=\exampledir\mycmemo,
-  example title=\mycmemo,
+  no attachment,
+  example title=\mymemo,
 }
 \endgroup
 
@@ -3379,12 +3347,9 @@
 referencing works as usual.  However, problems arise when we automemoize the
 inner environment.
 
-\ExampleName{label+}
-\makeexample{\examplename.tex.c1 N=6}
-\makeexample{\examplename.pdf N=2}
-\tcbinputexample{
+\tcbinputexample{label+}(.c1){
   sidebyside, lefthand ratio=0.53,
-  comment={\centering\includeexamplepdf[document page][\examplepath.c2.pdf]{page=1}},
+  comment={\centering\includeexamplepdf[document page](.c2){page=1}},
 }
 
 While the result looks fine at first, changing the order of |listii|
@@ -3393,22 +3358,11 @@
 the reference text is baked into the cc-memo, as shown below.
 
 \begingroup
-\relaxmmzcommands
-\def\mmzNewCCMemo#1{% fetch the first cc-memo filename
-  \def\myccmemo{#1}%
-  \endinput
-}
-\input{\examplepath.mmz.c1}
-\sed{%
-  s/~//g;
-  s/\cmd{mmzLabel} \marg\marg/~\0~/;
-  s/\(\marg\)\(\cmd{mmzIncludeExtern}\)/\1 \2/;
-  s/\(\marg\marg\marg\)\(\marg\marg\marg\marg\marg\)/\1\space\2/;
-}{\exampledir\myccmemo}
-\tcbinputlisting{
+\input{\exampledir label+.ccmemo}
+\tcbinputexample{label+}[.ccmemo]{
   listing only,
-  listing file=\exampledir\myccmemo,
-  example title=\myccmemo,
+  no attachment,
+  example title=\mymemo,
 }
 \endgroup
 
@@ -3416,7 +3370,7 @@
 extern by putting an (invisible) reference to the outer item into the inner
 item: add |\label{item:pets}| to item ``pets'' and refer to it at ``dog'' by
 \refcmd{mmzNoRef}|{item:pets}|.%
-\attachexample[\examplename mmzNoRef.tex][\examplepath.tex.c3.attachment]
+\attachexample[label+mmzNoRef.tex][\exampledir label+.tex.c3.attachment]
 
 An automatic variant of the recompilation solution is to add \cs{@currentlabel}
 to the context upon memoizing |listii|.  This can be achieved by adding
@@ -3423,7 +3377,7 @@
 \refmmz{context}|={@currentlabel={\csuse{@currentlabel}}}| to the \refmmz{auto}
 declaration for |listii|. The downside of this approach is that every |listii|
 will get reexternalized upon movement, whether it actually contains a label or
-not.\attachexample[\examplename context.tex][\examplepath.tex.c4.attachment]
+not.\attachexample[label+context.tex][\exampledir label+.tex.c4.attachment]
 
 In fact, given that the externs produced by the inner environment do not
 contain the value of the outer counter, it seems wasteful to recompile any
@@ -3440,7 +3394,7 @@
 value of the outer counter does not appear in the extern, i.e.\ it would not
 work the ``dog'' item was prefixed by |1a)| rather than simply |a)|.  In those
 cases, one should deploy one of the other solutions.%
-\attachexample[\examplename listii.tex][\examplepath.tex.c5.attachment]
+\attachexample[label+listii.tex][\exampledir label+.tex.c5.attachment]
 
 The final solution, presented below, is an elaboration on the second one.
 Rather than append \cs{@currentlabel} to the context immediately upon beginning
@@ -3473,8 +3427,8 @@
 \refcmd{AdviceOuterHandler} (for the full list, see
 section~\ref{sec:tut:automemoization-details} or~\ref{sec:ref:advice}).
 
-\tcbinputexample[.tex][.c6]{listing only, float,
-  attachment name=\examplename auto.tex,
+\tcbinputexample{label+}(.c6){listing only, float,
+  attachment=label+auto.tex,
 }
 
 Within \refcmd{AdviceSetup}, we prefix (using macro \cs{preto} of package
@@ -3541,11 +3495,13 @@
   should be understood as relative to our memoized picture, i.e.\ as the final
   overlay containing the memoized picture.}\footnote{Actually, putting this
   \cs{only} command only into the first cc-memo would suffice, but would be
-  harder to implement.}  but there is a problem: the final overlay number is
-unknown when we're memoizing our picture --- it is unknown even when we're
-memoizing the picture on final overlay itself (we simply don't know yet that
-this overlay will end up being the final one), let alone during the memoization
-on the first overlay.
+  harder to implement.}\footnote{In the actual implementation, the \meta{final
+    overlay number} is also prefixed by \code{all:}, to have this work in all
+  Beamer modes.}  but there is a problem: the final overlay number is unknown
+when we're memoizing our picture --- it is unknown even when we're memoizing
+the picture on final overlay itself (we simply don't know yet that this overlay
+will end up being the final one), let alone during the memoization on the first
+overlay.
 
 The solution exploits the fact that \emph{the c-memo is rewritten at each
   memoization}: at each memoization of our picture, we store the the
@@ -3556,9 +3512,7 @@
 overlay specification of the dummy |\only|.  Below, you can see all this in
 code, as the argument to \refmmz{at begin memoization}.
 
-\ExampleName{per-overlay-v1}
-\makeexample{\examplename.sty}
-\tcbinputexample[.sty]{
+\tcbinputexample{per-overlay-v1}[.sty]{
   listing only,
   title={The implementation of \refmmz{per overlay} (first attempt)},
 }
@@ -3626,11 +3580,8 @@
 
 \medskip % manual, to avoid an orphan
 
-\ExampleName{per-overlay}
-\makeexcerpt{per-overlay}
-\tcbinputexample[.tex][.excerpt]{%
-  listing only, one file,
-  left=0pt, % manual indentation gobble
+\tcbinputexample{per-overlay}[.excerpt]{%
+  listing only, no .listing,
   title={The implementation of \refmmz{per overlay}},
 }
 
@@ -3637,11 +3588,12 @@
 Are we done?  Almost.  The final issue is that once we have introduced support
 for pauses, we have to relativize |\mmzBeamerOverlays| (the final overlay
 number) to |beamerpause|.  So instead of a simple |\gdef\mmzBeamerOverlays| in
-the first version, we define |\mmzSetBeamerOverlays|\nohyphen\marg{beamer
-  pauses}\marg{final overlay number}, which sets |\mmzBeamerOverlays| only if
-\meta{beamer pauses} argument matches the value of |beamerpauses| (at its
-invocation in the c-memo).  Well, the macro has some other housekeeping to do
-as well: it is self-replicating, so that during potential memoization, the
+the first version, we define
+\docaux{cmd}{mmzSetBeamerOverlays}\nohyphen\marg{beamer pauses}\marg{final
+  overlay number}, which sets |\mmzBeamerOverlays| only if \meta{beamer pauses}
+argument matches the value of |beamerpauses| (at its invocation in the c-memo).
+Well, the macro has some other housekeeping to do as well: it is
+self-replicating, so that during potential memoization, the
 |\mmzBeamerOverlays| values belonging to non-current |beamerpauses| values get
 rewritten into the c-memo.\footnote{As replication should only occur during
   memoization (actually, it \emph{can} only occur then, anyway), the
@@ -3659,49 +3611,66 @@
 
 We are now truly done, and we can look at the final result, the c-memo and the
 cc-memo belonging to the extern on the first overlay of the example from
-section~\ref{sec:tut:beamer}.  Specifically, look at the |\mmzSetBeamerOverlays
-{1}{2}|, which says that the extern chain started when |beamerpauses| equals 1
-should continue up to overlay 2, and at the (expanded) context included at the
-end of the cc-memo, courtesy of \refmmz{include context in ccmemo}, where you
-can see that the cc-memo will be used when on the first overlay (|overlay=1|)
-when preceded by no \cs{pause} command (|pauses=1|).
+section~\ref{sec:tut:beamer}.  Specifically, look at the
+\code{\refcmd{mmzSetBeamerOverlays}\braces{1}\braces{2}}, which says that the
+extern chain started when |beamerpauses| equals 1 should continue up to overlay
+2, and at the (expanded) context included at the end of the cc-memo, courtesy
+of \refmmz{include context in ccmemo}, where you can see that the cc-memo will
+be used when on the first overlay (|overlay=1|) when preceded by no \cs{pause}
+command (|pauses=1|).
 
 \begingroup
-\relaxmmzcommands
-\def\mmzNewCMemo#1{% fetch the first c-memo filename
-  \def\mycmemo{#1}%
+\input{\exampledir beamer.cmemo}
+\tcbinputexample{beamer}[.cmemo]{
+  listing only,
+  no attachment,
+  example title=\mymemo,
 }
-\def\mmzNewCCMemo#1{% fetch the first cc-memo filename
-  \def\myccmemo{#1}%
-  \endinput
-}
-\input{\exampledir beamer.mmz.c1}
-\sed{%
-  s/~//g;
-  s/\cmd{mmzSetBeamerOverlays} \marg\marg/~\0~/;
-}{\exampledir\mycmemo}
-\sed{%
-  s/~//g;
-  s/overlay=[0-9]*/~\0~/;
-  s/pauses=[0-9]*/~\0~/;
-  s/\(\cmd{quitvmode}\) \(\cmd{only}\)/\1\n\2/;
-  s/\rbrace\(\cmd{mmzIncludeExtern}\)/\rbrace\percentchar\n\1/;
-  s/\rbrace\(\cmd{setcounter}\)/\rbrace\percentchar\n\1/;
-  s/\(\marg\)\cmd{global}/\1\n\cmd{global}/;
-}{\exampledir\myccmemo}
-
-\tcbinputlisting{
+\input{\exampledir beamer.ccmemo}
+\tcbinputexample{beamer}[.ccmemo]{
   listing only,
-  listing file=\exampledir\mycmemo,
-  example title=\mycmemo,
+  no attachment,
+  example title=\mymemo,
 }
+\endgroup
 
-\tcbinputlisting{
-  listing only, 
-  listing file=\exampledir\myccmemo,
-  example title=\myccmemo,
+
+\paragraph{An application of \refmmz{salt}}
+
+Knowing the role of a c-memo in driving the creation of Beamer overlays, we are
+ready for an application of a key from the \refmmz{salt} family.  Key
+\refmmz{salt} has a similar effect to \refmmz{context}: it contributes towards
+an md5 sum of a memo.  However, unlike \refmmz{context}, \refmmz{salt} impacts
+the code hash, which is actually the md5 sum of the concatenation of the salt
+and the memoized code.  (As this md5 sum is calculated prior to memoization, 
+using \refmmz{salt} and friends during memoization has no effect.)
+
+While \refmmz{salt} and \refmmz{context} are most often interchangeable, the
+following example crucially requires the former.  The goal is to have the memos
+and externs depend on the definition of command \cs{N}.  In non-Beamer
+documents, we can achieve this by putting the meaning of \cs{N} into the
+context.  In Beamer documents, however, this does not work.  Each meaning of
+\cs{N} should form a separate chain of externs, and these chains may be of
+different length (and in the example, they are).  As we are storing the length
+of the chains in c-memos (in \refcmd{mmzSetBeamerOverlays}), it follows that
+each value of \cs{N} should receive its own c-memo.  A c-memo is identified by
+a single md5 sum, the code md5 sum, so the meaning of \cs{N} must contribute
+towards this md5 sum.  In other words, we must salt the memoized code with the
+meaning of \cs{N}.  Below, if we had put \cs{N} into the context rather than 
+the salt, the two frames would create the same number of overlays: two, the 
+number of overlays created by the final frame.
+
+
+\tcbinputexample{salt}{
+  sidebyside, lefthand ratio=0.65,
+  comment={\centering
+    \includeexamplepdf[extern page,left=2mm,right=2mm]{page=1,trim=1in 1in 1in 1in}\\[1ex]
+    \includeexamplepdf[extern page,left=2mm,right=2mm]{page=3,trim=1in 1in 1in 1in}\\[1ex]
+    \includeexamplepdf[extern page,left=2mm,right=2mm]{page=5,trim=1in 1in 1in 1in}\\[1ex]
+    \includeexamplepdf[extern page,left=2mm,right=2mm]{page=7,trim=1in 1in 1in 1in}\\[1ex]
+    \includeexamplepdf[extern page,left=2mm,right=2mm]{page=9,trim=1in 1in 1in 1in}
+  },
 }
-\endgroup
 
 
 \subsection{Record files}
@@ -3734,19 +3703,13 @@
 produced by the titlepage illustration.  In fact, we have two versions of this
 file, as it changes upon the second compilation.
 
-\ExampleName{titlepage}
-\makeexample{\examplename.pdf N=2}
-\sed{%
-  s/~//g;
-  s/\cmd{mmzNewExtern}/~\0~/;
-}{\examplepath.mmz.c1}
-\tcbinputexample[.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[.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},
 }
@@ -3874,13 +3837,9 @@
 number in the |.pdf|; this file could be fed to a custom extern extraction
 tool.
 
-\ExampleName{record-files}
-\makeexample{\examplename.tex.c1}
-\tcbinputexample{listing only}
+\tcbinputexample{record-files}{listing only}
 
-\ExampleName{record-extern-pages}
-\makeexample{\examplename.tex.c1}
-\tcbinputexample{listing only}
+\tcbinputexample{record-extern-pages}{listing only}
 
 Finally, note that (unlike memos and externs) record files are auxiliary files
 and may be deleted at any time after the extraction of the externs produced in
@@ -3958,12 +3917,11 @@
 depending on the value of key \refmmz{capture}.  Let us look at the definition
 of the driver line by line:
 
-\makeexcerpt{single-extern-driver}
-\tcbinputexample[.tex][.excerpt]{%
-  listing only, one file,
+\tcbinputexample{single-extern-driver}[.excerpt]{%
+  listing only, no .listing,
   listing options app={numbers=left, numberstyle=\tiny, numbersep=0.5em},
   title=The default memoization driver,
-  float,
+  float, no attachment,
 }
 
 \begin{enumerate}
@@ -4011,7 +3969,7 @@
 actually, of the c-memo as well) is indirect, as described above.
 \begin{itemize}
 \item For one, the indirect construction facilitates potential abortion of
-  memoization (see section~\ref{sec:tut:good-to-know}).  With the indirect route,
+  memoization (see section~\ref{sec:limits}).  With the indirect route,
   aborting is easy --- as nothing was permanently written anywhere yet, Memoize
   simply skips the final part of the process, where extern boxes are shipped
   into extern pages and the memo registers written into memo files --- and also
@@ -4038,21 +3996,15 @@
 of a (pgfmath) computation (let's pretend that the computation is
 time-consuming).
 
-\ExampleName{pgfmathparse}
-\makeexample{\examplename.pdf}
 \begingroup
-\relaxmmzcommands
-\def\mmzNewCCMemo#1{% fetch the first cc-memo filename
-  \def\myccmemo{#1}%
-  \endinput
-}
-\input{\examplepath.mmz.c1}
-\tcbinputexample{%
+\input{\exampledir pgfmathparse.ccmemo}
+\tcbinputexample{pgfmathparse}{%
   comment={%
-    \tcbinputlisting{
-      listing only, width=.4\linewidth, nobeforeafter,
-      listing file=\exampledir\myccmemo,
-      example title, title=the cc-memo,
+    \tcbinputexample{pgfmathparse}{
+      listing only, no attachment,
+      width=.4\linewidth, nobeforeafter,
+      listing file=\exampledir\mymemo,
+      title=the cc-memo,
     }\quad
     \includeexamplepdf[document page]{page=1}
   },
@@ -4081,9 +4033,7 @@
 Let us consider an alternative implementation of the same goal of memoizing the
 result of a pgfmath computation, showcasing a couple of useful tricks.
 
-\ExampleName{pgfmathparse-embellished}
-\makeexample{\examplename.pdf}
-\tcbinputexample{listing only}
+\tcbinputexample{pgfmathparse-embellished}{listing only}
 
 For one, this ``embellished'' example reminds us that we can list the
 \refmmz{driver} key among the auto-options (even if I don't really recommend
@@ -4100,7 +4050,7 @@
 surprise here, as we want the effect of memoization and utilization to be the
 same.  In the embellished version, we advertise another way to achieve the same
 effect, a way which might be useful for complicated drivers: we simply smuggle
-out the entire cc-memo.  The idea works even when memoization procudes externs;
+out the entire cc-memo.  The idea works even when memoization produces externs;
 in that case, however, the driver also has to say \cs{mmzkeepexternstrue} ---
 conditional \refcmd{ifmmzkeepexterns} decides whether Memoize keeps the externs
 around, in memory, even after shipping them out (but they are always gone at
@@ -4126,10 +4076,7 @@
 properly, the chunks of the countdown that should appear on separate pages must
 be externalized into separate externs, as shown below.
 
-\ExampleName{countdown}
-\makeexample{\examplename.sty N=2}
-\makeexample{\examplename.pdf}
-\tcbinputexample{%
+\tcbinputexample{countdown}(.c1){%
   listing options app={
     basicstyle=\ttfamily\footnotesize,
   },
@@ -4145,7 +4092,7 @@
     }%
     \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}&
@@ -4200,7 +4147,7 @@
   (rather than at the end of memoization), so we expand it when applying the
   auto-options.}
 
-\tcbinputexample[.sty]{listing only, after title pre={\ (version 1)}}
+\tcbinputexample{countdown}[.sty](.c1){listing only, after title pre={\ (version 1)}}
 
 Of course, the chunks of the countdown should only be externalized when the
 code is actually being memoized, and not, say, when Memoize is disabled or
@@ -4244,8 +4191,10 @@
   integrated drivers of potentially recursive commands; we will talk about this
   in section~\ref{sec:memoization-complex-single-driver}.}
 
-\tcbinputexample[.sty][.c2]{listing only, after title pre={\ (version 2)},
-  attachment name=\examplename-integrated-driver.sty,
+\tcbinputexample{countdown}[.sty](.c2){
+  listing only,
+  after title pre={\ (version 2)},
+  attachment=countdown-integrated-driver.sty,
 }
 
 
@@ -4262,9 +4211,6 @@
 this approach had a negative impact on the user interface to automemoization.
 In this section, we will deploy the memoization driver to overcome the issue.
 
-\ExampleName{poormansbox-driver}
-\makeexample{\examplename.sty}
-\makeexample{\examplename.pdf N=2}
 
 Let us revisit the |poormansbox| example from
 section~\ref{sec:memoizable-design}.  Remember that that environment produced
@@ -4273,18 +4219,20 @@
 memoized, but rather executed at every invocation of the command, as it was
 primarily intended to put some stretchable vertical space around the box.
 
-The document source\attachexample\ 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 idea from the original implementation: the outer command will
-execute the pre- and the post-code, and the inner command will typeset the box.
-But unlike in the original implementation, we will not automemoize the inner,
-internal command (this was the source of the author's discomfort) but the outer,
+The document
+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
+idea from the original implementation: the outer command will execute the pre-
+and the post-code, and the inner command will typeset the box.  But unlike in
+the original implementation, we will not automemoize the inner, internal
+command (this was the source of the author's discomfort) but the outer,
 user-level command --- and we will equip it with a custom memoization driver.
 The major idea here is to have the driver compose a cc-memo which not only
 includes the extern, but also executes the outer command.
 
-\tcbinputexample[.sty]{listing only, float}
+\tcbinputexample{poormansbox-driver}[.sty]{listing only, float}
 
 In detail, the implementation (partially shown in the |.sty| listing) is as
 follows.  The outer command (|\poormansbox at outer|) first applies the options
@@ -4305,24 +4253,12 @@
 argument to |\poormansbox at outer| there is a call to \refcmd{mmzIncludeExtern}.
 
 \begingroup
-\relaxmmzcommands
-\def\mmzNewCCMemo#1{%
-  \def\mmzNewCCMemo##1{% fetch the second cc-memo filename
-    \def\myccmemo{##1}%
-    \endinput
-  }%
-}
-\input{\examplepath.mmz.c1}
-\sed{%
-  s/~//g;
-  s/\(\cmd{csuse} *{poormansbox at outer}\) *\({\nobrace*\marg\nobrace*}\)\({.*}\rbrace\)/~\1~\2~\3~/;
-  s/\(\marg\marg\marg\)\(\marg\marg\marg\marg\marg\)/\1\space\2/;
-}{\exampledir\myccmemo}
-\tcbinputlisting{
+\input{\exampledir poormansbox-driver.ccmemo}
+\tcbinputexample{poormansbox-driver}[.ccmemo]{
   listing only, left=1.5mm, right=1mm,
   listing options app={basicstyle=\tt\small},
-  listing file=\exampledir\myccmemo,
-  example title, title=the second poor man's box's cc-memo,
+  title=the second poor man's box's cc-memo,
+  no attachment,
 }%
 \endgroup
 
@@ -4525,7 +4461,7 @@
 it makes sense to separate them out as an independent component of the
 framework, with the added bonus that the system can make sure that an
 invocation of a advised command which does not satisfy the run conditions
-will incur as litte overhead as possible.
+will incur as little overhead as possible.
 
 \paragraph{Bailout handler}
 An automemoized command applies the next-options (set by \refcmd{mmznext}), but
@@ -4702,9 +4638,8 @@
 \refcmd{begin}, and this is why the call of \refcmd{AdviceGetOriginal} is of
 course followed by the environment name.
 
-\makeexcerpt{_auto-memoize-inner}
-\tcbinputexample[.tex][.excerpt]{%
-  listing and comment, one file, no attachment,
+\tcbinputexample{_auto-memoize-inner}[.excerpt]{%
+  listing and comment, no .listing, no attachment,
   title={The implementation of the \refmmzauto{inner handler}
     for automemoization},
   comment={%
@@ -4724,9 +4659,8 @@
 that the invocation of \refcmd{AdviceCollector} is the sole function of the
 default outer handler.
 
-\makeexcerpt{_auto-memoize-outer}
-\tcbinputexample[.tex][.excerpt]{%
-  listing only, one file, no attachment,
+\tcbinputexample{_auto-memoize-outer}[.excerpt]{%
+  listing only, no .listing, no attachment,
   title={The implementation of the \refmmzauto{outer handler}
     for automemoization},
 }
@@ -4742,9 +4676,8 @@
 diagram in section~\ref{sec:Memoize}).  Note that it is not necessary to invoke
 \refcmd{AdviceRunfalse} in branches where the run conditions are not satisfied.
 
-\makeexcerpt{_auto-run-if-memoization-is-possible}
-\tcbinputexample[.tex][.excerpt]{%
-  listing only, one file, no attachment,
+\tcbinputexample{_auto-run-if-memoization-is-possible}[.excerpt]{%
+  listing only, no .listing, no attachment,
   title={The implementation of 
     \refmmzauto{run if memoization is possible}},
 }
@@ -4760,9 +4693,8 @@
 \refmmzauto{bailout handler} makes sure they will not erroneously apply to the
 next instance of (auto)memoization.
 
-\makeexcerpt{_auto-memoize-bailout}
-\tcbinputexample[.tex][.excerpt]{%
-  listing only, one file, no attachment,
+\tcbinputexample{_auto-memoize-bailout}[.excerpt]{%
+  listing only, no .listing, no attachment,
   title={The implementation of the \refmmzauto{bailout handler}
     for automemoization},
 }
@@ -4793,9 +4725,7 @@
 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}.
 
-\ExampleName{_auto-ref}
-\makeexample{\examplename.tex.c1}
-\tcbinputexample{%
+\tcbinputexample{auto-ref}{%
   listing only, no attachment,
   title={\hypercolor{link}{white}A simplified\footnotemark{} definition
     of \refmmzauto{ref}},
@@ -4818,9 +4748,8 @@
 \refcmd{AdviceRuntrue}, which implies \refcmd{AdviceRunfalse}, which triggers
 the execution of the original command after the run conditions are ``checked.''
 
-\makeexcerpt{_auto-abort}
-\tcbinputexample[.tex][.excerpt]{%
-  listing only, one file, no attachment,
+\tcbinputexample{_auto-abort}[.excerpt]{%
+  listing only, no .listing, no attachment,
   title={The definition of \refmmzauto{abort}},
 }
 
@@ -4844,9 +4773,7 @@
 effect, the box will appear within parenthesis; if we reverse the activation
 order, the parenthesis will appear inside the box.
 
-\ExampleName{chained-advice}
-\makeexample{\examplename.tex.c1 N=2}
-\tcbinputexample{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
@@ -4880,9 +4807,7 @@
 branch, we omit the optional argument, passing it an (additionally) braced
 |{#2}|.
 
-\ExampleName{om-collector-NewDocumentCommand}
-\makeexample{\examplename.tex.c1}
-\tcbinputexample{listing only}
+\tcbinputexample{om-collector-NewDocumentCommand}{listing only}
 
 Defining a functionally equivalent collector using \cs{newcommand} would be a
 bit more involved, as \hologo{LaTeX2e} does not offer a standardized way to
@@ -4890,9 +4815,7 @@
 collector, whose optional argument has the same default value as the advised
 command.  Is it functionally equivalent to the one above?
 
-\ExampleName{om-collector-newcommand}
-\makeexample{\examplename.tex.c1}
-\tcbinputexample{listing only}
+\tcbinputexample{om-collector-newcommand}{listing only}
 
 While there will be no visual difference, there is a difference under the hood.
 If you compile both documents, you will see that the first one creates three
@@ -4968,9 +4891,7 @@
   braced, behind its \meta{next-code} argument, |\PrintAndDo\makebox|, yielding
   |\PrintAndDo|\hyp|\makebox{[5em][r]{text}}|.\par}
 
-\ExampleName{collargs-makebox}
-\makeexample{\examplename.tex.c1}
-\tcbinputexample{listing and compile}
+\tcbinputexample{collargs-makebox}{listing and compile}
 
 Seeing the arguments of |\makebox| without the immediately preceding |\makebox|
 might seem strange, but remember that \refcmd{CollectArguments} is about the
@@ -5003,9 +4924,7 @@
   \cs{end}\meta{name} in \hologo{plainTeX} and by \cs{start}\meta{name} and
   \cs{stop}\meta{name} in \hologo{ConTeXt}.}
 
-\ExampleName{collargs-minipage}
-\makeexample{\examplename.tex.c1}
-\tcbinputexample{comment=\input{\examplepath.tex.c1}}
+\tcbinputexample{collargs-minipage}{comment=\input{\examplepath.tex}}
 
 You might wonder why didn't we provide \refcmd{CollectArguments} in the
 previous example with argument specification |omb| --- after all, the
@@ -5031,12 +4950,11 @@
 section~\ref{sec:ref:collargs} for the full reference on the verbatim mode and
 its limitations.
 
-% A harmless warning: 
+% .dtx has separate versions for listing and compilation, because compilation
+% of the multi-line version yields:
 % Missing character: There is no ^M (U+000D) in font [lmmono10-regular]:!
 % because \texttt in the example is fed a (verbatim) carriage return
-\ExampleName{collargs-verbatim}
-\makeexample{\examplename.tex.c1}
-\tcbinputexample{listing and compile}
+\tcbinputexample{collargs-verbatim}{listing and compile}
 
 Finally, CollArgs extends the \hologo{LaTeX3}\slash\pkg{xparse} specification
 by modifier \docref{xparse:amp}, which allows the user to specify options which
@@ -5100,9 +5018,8 @@
 \refcmd{AdviceArgs} (line~4), which also receives the argument specification
 when given by the user via key \refmmzauto{args}.
 
-\makeexcerpt{_advice-CollectArgumentsRaw}(../../advice.edtx)
-\tcbinputexample[.tex][.excerpt]{%
-  listing only, one file, no attachment,
+\tcbinputexample{_advice-CollectArgumentsRaw}[.excerpt]{%
+  listing only, no .listing, no attachment,
   listing options app={numbers=left, numberstyle=\tiny, numbersep=0.5em},
   title={The definition of the initial collector},
 }
@@ -5202,7 +5119,7 @@
 using key \refmmz{extract}; I recommend doing this immediately after loading
 the package.  This key may be invoked with or without a value.  In the latter
 case, Memoize will extract using the package default method
-\refmmz{extract=perl}, unless its has been overriden from
+\refmmz{extract=perl}, unless its has been overridden from
 \reffile{memoize.cfg}.
 
 Furthermore, as \hologo{plainTeX} has no concept of a document body, the text
@@ -5217,13 +5134,9 @@
 this means that Memoize must be loaded before \pkg{atbegshi}.
 
 \begin{tcboxedraster}[raster column skip=1cm]{blankest}
-  \ExampleName{plainTeX}%
-  \makeexample{\examplename.tex.c1}%
-  \tcbinputexample{listing only, title=A minimal \hologo{plainTeX} example}
+  \tcbinputexample{plainTeX}{listing only, title=A minimal \hologo{plainTeX} example}
   %
-  \ExampleName{ConTeXt}%
-  \makeexample{\examplename.tex.c1}%
-  \tcbinputexample{listing only, title=A minimal \hologo{ConTeXt} example}
+  \tcbinputexample{ConTeXt}{listing only, title=A minimal \hologo{ConTeXt} example}
 \end{tcboxedraster}
 
 \paragraph{\hologo{ConTeXt}}{}
@@ -5658,6 +5571,37 @@
 \end{doc}
 
 \begin{doc}{
+    key={name=salt, par=\meta{tokens}, desc={cumulative, no default,
+        initially empty}},
+    key={name=clear salt},
+    key={name=meaning to salt,
+      par=\marg{comma-separated list of commands and environment names}},
+    key={name=csname meaning to salt, par=\marg{control sequence name}},
+    key={name=key meaning to salt,
+      par=\marg{full path to a pgfkeys command key}},
+    key={name=key value to salt,
+      par=\marg{full path to a pgfkeys value key}},
+    keypath={/handlers}, desc=handler,
+    key={name=.meaning to salt},
+    key={name=.value to salt},
+  }
+  These keys manipulate the \emph{salt} expression, internally stored in token
+  register \docaux{cmd}{mmzSalt}.  Fully expanded (at the beginning of
+  memoization), this expression is prepended to the memoized code and
+  contributes to its code md5 sum.  In other words, two pieces of the same code
+  memoized under a different expansion of the salt will behave as if they
+  contained different code; most importantly, they will have distinct c-memos.
+  
+  The keys listed above behave in the same way as their \refmmz{context}
+  counterparts used outside memoization, i.e.\ in the same way as the local
+  variant of the \refmmz{context} keys.  Using the salt keys during memoization
+  has no effect.
+
+  While salt and context are mostly interchangeable, one example where only the
+  salt can do the job is presented in the Beamer section~\ref{sec:per-overlay}.
+\end{doc}
+
+\begin{doc}{
     cmd={name=mmzNoRef, par=\marg{reference key}, desc=\hologo{LaTeX} only},
     cmd={name=mmzForceNoRef, par=\marg{reference key}, desc=\hologo{LaTeX} only},
   }
@@ -5920,7 +5864,7 @@
 \begin{doc}{
     cmd={name=mmzExternalizeBox, par=\marg{box}\marg{token register}},
   }
-  This macro is indended to be called by memoization drivers to produce an
+  This macro is intended to be called by memoization drivers to produce an
   extern page.  The given \meta{box} is dumped into the document as a separate
   extern page, while the \meta{token register} receives the cc-memo extern
   inclusion code.
@@ -5977,7 +5921,7 @@
   defined to include the extern file into the document.  However, it sometimes
   makes sense to execute the cc-memo contents immediately after memoization;
   for example, if memoization produces several externs, intricately integrated
-  into the surrouding environment, it might be cumbersome to replicate their
+  into the surrounding environment, it might be cumbersome to replicate their
   typesetting both in the memoizing compilation and in the cc-memo code ---
   easier to build up the cc-memo code and execute it right after memoization.
   This is why Memoize, just before executing the contents of \refmmz{after
@@ -6640,7 +6584,7 @@
     using \hologo{TeX}-based extraction, externalization using Memoize is
     extremely fast compared to the \TikZ's externalization library.  Adding
     the regular compilation time of one minute to the above numbers, we arrive
-    at the maximum externalization time of about two minues, whereas my
+    at the maximum externalization time of about two minutes, whereas my
     estimate for the production of all 160 externs using \TikZ's
     externalization would be an \emph{hour} or more.
   \item The Python script cannot extract externs out of PDFs created without
@@ -6698,9 +6642,8 @@
   \refmmz[show keypath]{record/record type/new extern} key for and \meta{record
     type}.
 
-  \makeexcerpt{tex-extraction-options}
-  \tcbinputexample[.tex][.excerpt]{%
-    listing only, one file, no attachment, title={The initial value of
+  \tcbinputexample{tex-extraction-options}[.excerpt]{%
+    listing only, no .listing, no attachment, title={The initial value of
       \refmmz{tex extraction options}},
   }
 
@@ -6720,9 +6663,8 @@
     \code{-output-driver 'xdvipdfmx -V $N$'}.} note that Memoize defines
   \docref{reg:pdfmajorversion} and \docref{reg:pdfminorversion} in \hologo{LuaTeX}.
 
-  \makeexcerpt{tex-extraction-script}
-  \tcbinputexample[.tex][.excerpt]{%
-    listing only, one file, title=The initial value of \refmmz{tex extraction
+  \tcbinputexample{tex-extraction-script}[.excerpt]{%
+    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,
@@ -6901,7 +6843,7 @@
     }
     When given this option, the script removes \emph{all} memos and externs
     belonging to the document, not just the stale ones, i.e.\ it effectively
-    ignores the occurences of \refcmd{mmzUsedCMemo} and friends in the \dmmz
+    ignores the occurrences of \refcmd{mmzUsedCMemo} and friends in the \dmmz
     file.
   \end{doc}
   \begin{doc}{
@@ -7263,7 +7205,7 @@
   
   As the advice is normally automatically activated upon declaration with
   \refmmz{auto}, explicit activation is rarely needed, but see \refmmz{auto'}.
-  The effect of these keys under the deffered activation regime is described in
+  The effect of these keys under the deferred activation regime is described in
   \refmmz{activation}.
 
   Note that I sometimes speak of (de)activating a command, and sometimes of
@@ -8005,7 +7947,7 @@
   This command collects the arguments in the format expected by \refcmd{tikz}, and
   executes macro \refcmd{AdviceInnerHandler} with the collected arguments given
   as a single braced argument.  The collector supports both the group and the
-  semicolor invocation of |\tikz|, i.e.\ both |\tikz{...}| and |\tikz...;|.
+  semicolon invocation of |\tikz|, i.e.\ both |\tikz{...}| and |\tikz...;|.
 
   This command is only available upon |\input|ting file
   \docaux{file}{advice-tikz.code.tex}.
@@ -8523,7 +8465,7 @@
 }|\marg{argument specification}\marg{next-code}|
   \end{tcblisting}
   
-  Withing the option-setting code, the programmer may also deploy macro
+  Within the option-setting code, the programmer may also deploy macro
   \refcmd{collargsSet}, which processes the \meta{options} in the keylist
   format.  One idea could be to execute this macro at the end of the low-level
   options; this would set the ``defaults'' using the fast programmer's
@@ -8654,10 +8596,10 @@
   ...
 \end{foo}
     \end{tcblisting}
-    \ExampleName{_collargs-verbatim}
-    \makeexample{\examplename.tex.c1}
-    \tcbinputexample{listing only, no attachment, mark region={1}{3}, 
-        example title=\texttt{ignore nesting=true}}
+    \tcbinputexample{collargs-ignore-nesting-true}{
+      listing only, no attachment, mark region={1}{3}, 
+      example title=\texttt{ignore nesting=true}
+    }
   \end{tcbraster}
 
   This key applies not only to argument type \docref{xparse:b} (in either
@@ -8690,11 +8632,11 @@
   environment |foo|.
 
   \begin{tcbraster}
-    \ExampleName{_collargs-ignore-other-tags}
-    \makeexample{\examplename.tex.c1 N=2}
-    \tcbinputexample{listing only, no attachment, mark region={3}{3},
+    \tcbinputexample{collargs-ignore-other-tags}(.c1){
+      listing only, no attachment, mark region={3}{3},
       example title=\texttt{ignore other tags=false}}
-    \tcbinputexample[.tex][.c2]{listing only, no attachment, mark region={3}{5},
+    \tcbinputexample{collargs-ignore-other-tags}(.c2){
+      listing only, no attachment, mark region={3}{5},
       example title=\texttt{ignore other tags=true}}
   \end{tcbraster}
 
@@ -8748,9 +8690,7 @@
   \refcollargs{verbatim}.  And we use \refcollargs{no delimiters} to get rid of
   the braces around the footnote text.)
   
-  \ExampleName{collargs-processor}
-  \makeexample{\examplename.tex.c1}
-  \tcbinputexample{comment=\input{\examplepath.tex.c1}}
+  \tcbinputexample{collargs-processor}{comment=\input{\examplepath.tex}}
 \end{doc}
 
 \begin{doc}[
@@ -8813,11 +8753,7 @@
     braces.
   \end{enumerate*}
   
-  \ExampleName{collargs-expandable-processor}
-  \makeexample{\examplename.tex.c1}
-  \tcbinputexample{comment=\input{\examplepath.tex.c1},
-    %listing options app={numbers=left, numberstyle=\tiny, numbersep=0.5em},
-  }
+  \tcbinputexample{collargs-expandable-processor}{comment=\input{\examplepath.tex}}
 \end{doc}
 
 \begin{doc}[
@@ -8833,9 +8769,7 @@
   Any user-specified pre- or post-processing will still be applied (and usually
   is, when this key is used).
   
-  \ExampleName{collargs-nodelimiters}
-  \makeexample{\examplename.tex.c1}
-  \tcbinputexample{comment=\small\input{\examplepath.tex.c1}}
+    \tcbinputexample{collargs-nodelimiters}{comment=\small\input{\examplepath.tex}}
 \end{doc}
 
 \begin{doc}[%
@@ -8873,9 +8807,7 @@
       definition of \cs{mmz at remove@quotes} and advising of \cs{blx at bbl@entry}
       in the Memoize source.}
 
-    \ExampleName{collargs-return-plain}
-    \makeexample{\examplename.tex.c1}
-    \tcbinputexample{comment=\small\input{\examplepath.tex.c1}}
+    \tcbinputexample{collargs-return-plain}{comment=\small\input{\examplepath.tex}}
   \item When set to \refcollargs{return=no}, the collected arguments are not
     inserted into the input stream; \meta{next-code} can access them through
     \refcmd{collargsArgs}, a token register dedicated to holding the
@@ -8896,9 +8828,7 @@
     conditional to true if any argument was found, and test for that
     conditional in the \meta{next-code}.)
     
-    \ExampleName{collargs-return-no}
-    \makeexample{\examplename.tex.c1}
-    \tcbinputexample{comment=\small\input{\examplepath.tex.c1}}
+    \tcbinputexample{collargs-return-no}{comment=\small\input{\examplepath.tex}}
   \end{itemize}
 \end{doc}
 
@@ -8949,7 +8879,7 @@
 collect |[{]}]| with \refcmd{CollectArguments}|[|\refmmz{verbatim}|]{o}|, we
 will get |{| (and most likely an error, as well), because in the
   \refmmz{verbatim} mode, braces do not have their grouping function.  Using
-  the \refmmz{verb} mode solves the problem: occuring within braces, the first
+  the \refmmz{verb} mode solves the problem: occurring within braces, the first
   |]| is ``invisible'' to \refcmd{CollectArguments}|[|\refmmz{verb}|]|, so the
 optional argument is correctly recognized as ending at the second |]|.
 
@@ -9086,10 +9016,8 @@
 resulting in error |! Missing $ inserted| %$
 once \hologo{TeX} encounters the superscript character |^|.
 
-\ExampleName{collargs-transition-ok}
-\makeexample{\examplename.tex.c1}
-\tcbinputexample{sidebyside, lefthand ratio=0.6,
-  comment=\input{\examplepath.tex.c1}}
+\tcbinputexample{collargs-transition-ok}{sidebyside, lefthand ratio=0.6,
+  comment=\input{\examplepath.tex}}
 
 Well --- this is what \emph{would} happen if CollArgs didn't address the
 transition issue described above.  In fact, the above example compiles just
@@ -9106,10 +9034,8 @@
 \emph{before} control sequence |\@author| is constructed, even if it precedes
 it immediately.
 
-\ExampleName{collargs-transition-cs}
-\makeexample{\examplename.tex.c1}
 \long\def\ShowArgs#1{Collected: ``{\color{red}\tt\detokenize{#1}}''}
-\tcbinputexample{comment=\input{\examplepath.tex.c1}}
+\tcbinputexample{collargs-transition-cs}{comment=\input{\examplepath.tex}}
 
 In the second line of the example, our clever invocation of |\@author| is
 immediately preceded by a call to \refcmd{CollectArguments}, which tries to
@@ -9158,10 +9084,8 @@
 (verbatim) mandatory argument, the rest of the line is already gone, so it
 searches for, and finds, this argument in the next line.
 
-\ExampleName{collargs-transition-comment}
-\makeexample{\examplename.tex.c1}
 \long\def\ShowArgs#1{Collected: ``{\color{red}\tt\detokenize{#1}}''}
-\tcbinputexample{listing and text}
+\tcbinputexample{collargs-transition-comment}{listing and text}
 
 Nothing can be done here --- commenting deletes information, irrevocably ---
 and in a similar fashion, nothing can be done to catch a verbatim end-of-line
@@ -9181,6 +9105,7 @@
 \subsection{Support for specific classes and packages}
 
 \subsubsection{PGF}
+\label{sec:support:pgf}
 
 \PGF support defines commands \refcmd{mmzPgfAtBeginMemoization} and
 \refcmd{mmzPgfAtEndMemoization}, and appends them to hooks \refmmz{at begin
@@ -9191,9 +9116,8 @@
 automemoization.  Doing this would probably not be a good idea, as it is used
 by many other commands and environments.
 
-\makeexcerpt{_support-pgf}
-\tcbinputexample[.tex][.excerpt]{%
-  listing only, one file, no attachment,
+\tcbinputexample{_support-pgf}[.excerpt]{%
+  listing only, no .listing, no attachment,
   title=\hypercolor{url}{white}\PGF support,
 }
 
@@ -9217,7 +9141,8 @@
     memoization}, remembers the PGF picture ID at the beginning of memoization.
   Command \refcmd{mmzPgfAtEndMemoization}, executed in hook \refmmz{at end
     memoization}, checks whether the ID was advanced during memoization, and if
-  so, appends to the cc-memo the code advancing the ID counter accordingly.
+  so, appends to the cc-memo an invocation of macro
+  \docaux{cmd}{mmzStepPgfPictureId} advancing the ID counter accordingly.
 
   Note that out of the box, \refcmd{mmzPgfAtBeginMemoization} and
   \refcmd{mmzPgfAtEndMemoization} reside in their respective hooks at all
@@ -9236,9 +9161,8 @@
 command \refcmd{tikz} requires a dedicated argument collector,
 \refcmd{AdviceCollectTikZArguments}.
 
-\makeexcerpt{_support-tikz}
-\tcbinputexample[.tex][.excerpt]{%
-  listing only, one file, no attachment,
+\tcbinputexample{_support-tikz}[.excerpt]{%
+  listing only, no .listing, no attachment,
   title=\hypercolor{url}{white}\TikZ support,
 }
 
@@ -9252,9 +9176,8 @@
 command \refcmd{Forest} is defined by \refcmd{NewDocumentCommand}, which makes
 specifying option \refmmzauto{args} unnecessary.
 
-\makeexcerpt{_support-forest}
-\tcbinputexample[.tex][.excerpt]{%
-  listing only, one file, no attachment,
+\tcbinputexample{_support-forest}[.excerpt]{%
+  listing only, no .listing, no attachment,
   title=\pkg[white]{Forest} support,
 }
 
@@ -9267,7 +9190,10 @@
 case because Beamer opens the document PDF while loading the class, while
 Memoize requires the PDF from the previous compilation intact in order to
 extract the externs.  The workaround is to load Memoize by writing
-|\RequirePackage{memoize}| \emph{before} |\documentclass{beamer}|.
+|\RequirePackage{memoize}| \emph{before} |\documentclass{beamer}|.  (The
+workaround is unnecessary when loading package \pkg{beamerarticle}, which runs
+the beamer in the |article| mode.  In fact, this package may be loaded before
+or after Memoize.)
 
 \begin{doc}{easy, key={name=per overlay,desc=style}}
   Applying this style to a piece of memoized code contained in a Beamer
@@ -9281,6 +9207,26 @@
   trivial, but only deploys the public interface offered by Memoize.
 \end{doc}
 
+\begin{doc}{easy, key={name=beamer mode to prefix,desc=style}}
+  Executing this key appends the beamer mode (|beamer|, |handout|, |trans| or
+  |article|) to the \refmmz{prefix}.  Use it when the externalized picture
+  should come out different in different modes.
+
+  It is fine to apply the key only to selected pieces of memoized code, either
+  via \refcmd{mmzset} or \refcmd{mmznext}.
+
+  Note that Beamer mode |second| is special.  Under the hood, it is implemented
+  as the default mode |beamer|.  This key therefore does not facilitate having
+  one set of externs for the single screen mode and another set for the two
+  screen mode.
+
+  A simple way of executing this key for every Beamer document, and not
+  producing an error for non-Beamer documents, is to include it in
+  \reffile{memoize.cfg} like this: \code{beamer mode to prefix/.try}.  The
+  \code{.try} handler (see \PGFmanual{87.4.8}) works because \refmmz{beamer
+    mode to prefix} is only defined when Beamer is loaded.
+\end{doc}
+
 \subsubsection{Biblatex}
 
 \begin{doc}{
@@ -9465,10 +9411,10 @@
 documentation directory of the respective package, i.e.\ in
 \code{\meta{texmf}/doc/generic/\meta{package}/CHANGELOG.md}.  They are written
 in the MarkDown format.  Here are direct links to these changelogs on
-CTAN:
-\href{https://mirrors.ctan.org/macros/generic/memoize/CHANGELOG.md}{Memoize},
-\href{https://mirrors.ctan.org/macros/generic/advice/CHANGELOG.md}{Advice},
-\href{https://mirrors.ctan.org/macros/generic/collargs/CHANGELOG.md}{CollArgs}.
+GitHub:
+\href{https://github.com/sasozivanovic/memoize/blob/main/CHANGELOG.md}{Memoize},
+\href{https://github.com/sasozivanovic/memoize/blob/main/doc/CHANGELOG.advice.md}{Advice},
+\href{https://github.com/sasozivanovic/memoize/blob/main/doc/CHANGELOG.collargs.md}{CollArgs}.
 
 \subsection{Known issues}
 \label{sec:known-issues}
@@ -9654,7 +9600,7 @@
   combination with the paranoid \docref{openout_any} setting (which is the
   default).
 
-  If the source of the error remains a mistery, I suggest inspecting the
+  If the source of the error remains a mystery, I suggest inspecting the
   following sources of information, to help you with your investigation:
   \begin{itemize}
   \item Can you can run the extraction script by hand?  Open the terminal, go
@@ -9776,13 +9722,17 @@
 \item you are trying to (auto)memoize a \refenv{tikzpicture} with
   \refkey{/tikz/remember picture} set, or more generally, some code which
   contains \refcmd{savepos} --- this can't be done, see
-  section~\ref{sec:tut:good-to-know}; or
+  section~\ref{sec:limits}; or
 \item an error occurred during memoization --- in this case, Memoize cowardly
   refuses to proceed with memoization, see section~\ref{sec:known-issues} for
   details.
 \end{itemize}
 
+\paragraph*{Memoization yields errors} while the original, non-memoized code
+compiles fine.
 
+\ProblemsWithMemoization[in section~\ref{sec:tut:verbatim}]
+
 \subsection{License}
 
 Copyright \textcopyright\ 2020- Sašo Živanović.

Modified: trunk/Master/texmf-dist/doc/generic/memoize/memoize-extract.1.md
===================================================================
--- trunk/Master/texmf-dist/doc/generic/memoize/memoize-extract.1.md	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/doc/generic/memoize/memoize-extract.1.md	2024-11-24 20:54:26 UTC (rev 72961)
@@ -2,8 +2,8 @@
 title: memoize-extract
 section: 1
 header: User Manual
-footer: memoize-extract of Memoize v1.3.0
-date: April 02, 2024
+footer: memoize-extract of Memoize v1.4.0
+date: November 24, 2024
 hyphenate: false
 ---
 
@@ -90,8 +90,8 @@
 This script respects the restrictions on file input and output imposed by the
 TeX configuration, more precisely, the variables *openin_any* and *openout_any*
 of the **kpathsea** library (https://tug.org/kpathsea). You can inspect the
-values of these variables by executing '**kpsewhich** -var-value=openin_any' and
-'**kpsewhich** -var-value=openout_any'.  The interpretation is as follows:
+values of these variables by executing `kpsewhich -var-value=openin_any` and
+`kpsewhich -var-value=openout_any`.  The interpretation is as follows:
 
 **a** (or **y** or **1**) any
 : Allows any file to be opened.
@@ -121,7 +121,7 @@
 
 **11**
 : An error also reported back to the compilation when given option
-  **\--format**. Currently, either: (i) a currupted document PDF, or (ii)
+  **\--format**. Currently, either: (i) a corrupted document PDF, or (ii)
   a kpathsea permission error.
 
 Other exit codes are as produced by the underlying scripting language (Perl of

Modified: trunk/Master/texmf-dist/doc/man/man1/memoize-clean.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/memoize-clean.1	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/doc/man/man1/memoize-clean.1	2024-11-24 20:54:26 UTC (rev 72961)
@@ -1,36 +1,18 @@
-.\" Automatically generated by Pandoc 3.1.6
+.\" Automatically generated by Pandoc 3.1.11.1
 .\"
-.\" Define V font for inline verbatim, using C font in formats
-.\" that render this, and otherwise B font.
-.ie "\f[CB]x\f[]"x" \{\
-. ftr V B
-. ftr VI BI
-. ftr VB B
-. ftr VBI BI
-.\}
-.el \{\
-. ftr V CR
-. ftr VI CI
-. ftr VB CB
-. ftr VBI CBI
-.\}
-.TH "memoize-clean" "1" "April 02, 2024" "memoize-clean of Memoize v1.3.0" "User Manual"
-.nh
+.TH "memoize\-clean" "1" "November 24, 2024" "memoize\-clean of Memoize v1.4.0" "User Manual"
 .SH NAME
-.PP
-memoize-clean.pl, memoize-clean.py - Remove (stale) memo and extern
+memoize\-clean.pl, memoize\-clean.py \- Remove (stale) memo and extern
 files
 .SH SYNOPSIS
-.PP
-\f[B]memoize-clean.pl\f[R] [\f[I]OPTIONS\f[R]] [\f[I]document1.mmz\f[R]
+\f[B]memoize\-clean.pl\f[R] [\f[I]OPTIONS\f[R]] [\f[I]document1.mmz\f[R]
 \&...]
 .PP
-\f[B]memoize-clean.py\f[R] [\f[I]OPTIONS\f[R]] [\f[I]document1.mmz\f[R]
+\f[B]memoize\-clean.py\f[R] [\f[I]OPTIONS\f[R]] [\f[I]document1.mmz\f[R]
 \&...]
 .SH DESCRIPTION
-.PP
-\f[B]memoize-clean\f[R] is a script accompanying Memoize, a TeX package
-which allows the author to reuse the results of compilation-intensive
+\f[B]memoize\-clean\f[R] is a script accompanying Memoize, a TeX package
+which allows the author to reuse the results of compilation\-intensive
 code such as TikZ pictures.
 .PP
 By default, this script removes stale memo and extern files.
@@ -40,33 +22,36 @@
 Typically, stale files arise when we change the memoized code (or its
 context).
 .PP
-\f[B]memoize-clean.pl\f[R] removes all memo and extern files with
+\f[B]memoize\-clean.pl\f[R] removes all memo and extern files with
 prefixes mentioned in the listed \f[B].mmz\f[R] files and by options
-\f[B]--prefix\f[R] which are not explicitly mentioned in the
+\f[B]\-\-prefix\f[R] which are not explicitly mentioned in the
 \f[B].mmz\f[R] files.
 .PP
-Before deleting anything, \f[B]memoize-clean.pl\f[R] lists all the files
-it would delete and asks for confirmation.
+Before deleting anything, \f[B]memoize\-clean.pl\f[R] lists all the
+files it would delete and asks for confirmation.
 .SH OPTIONS
 .TP
-\f[B]-p, --prefix\f[R]
+\f[B]\-p, \-\-prefix\f[R]
 Add a memo/extern prefix for cleaning.
 This option may be given multiple times.
 .TP
-\f[B]-a, --all\f[R]
+\f[B]\-a, \-\-all\f[R]
 Remove all memos and externs, rather than only the stale ones.
 .TP
-\f[B]-y, --yes\f[R]
+\f[B]\-y, \-\-yes\f[R]
 Do not ask for confirmation.
 .TP
-\f[B]-q, --quiet\f[R]
+\f[B]\-q, \-\-quiet\f[R]
 Don\[cq]t describe what\[cq]s happening.
 .TP
-\f[B]-h, --help\f[R]
+\f[B]\-h, \-\-help\f[R]
 Show help.
 .TP
-\f[B]-V, --version\f[R]
+\f[B]\-V, \-\-version\f[R]
 Show the Memoize version number and exit.
 .SH SEE ALSO
-.PP
-Memoize manual (https://ctan.org/pkg/memoize), section 6.6.3.
+\c
+.UR https://ctan.org/pkg/memoize
+Memoize manual
+.UE \c
+, section 6.6.3.

Modified: trunk/Master/texmf-dist/doc/man/man1/memoize-clean.man1.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/man/man1/memoize-clean.pl.man1.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/man/man1/memoize-clean.py.man1.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/man/man1/memoize-extract.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/memoize-extract.1	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/doc/man/man1/memoize-extract.1	2024-11-24 20:54:26 UTC (rev 72961)
@@ -1,44 +1,26 @@
-.\" Automatically generated by Pandoc 3.1.6
+.\" Automatically generated by Pandoc 3.1.11.1
 .\"
-.\" Define V font for inline verbatim, using C font in formats
-.\" that render this, and otherwise B font.
-.ie "\f[CB]x\f[]"x" \{\
-. ftr V B
-. ftr VI BI
-. ftr VB B
-. ftr VBI BI
-.\}
-.el \{\
-. ftr V CR
-. ftr VI CI
-. ftr VB CB
-. ftr VBI CBI
-.\}
-.TH "memoize-extract" "1" "April 02, 2024" "memoize-extract of Memoize v1.3.0" "User Manual"
-.nh
+.TH "memoize\-extract" "1" "November 24, 2024" "memoize\-extract of Memoize v1.4.0" "User Manual"
 .SH NAME
-.PP
-memoize-extract.pl, memoize-extract.py - Extract extern pages out of the
-PDF
+memoize\-extract.pl, memoize\-extract.py \- Extract extern pages out of
+the PDF
 .SH SYNOPSIS
+\f[B]memoize\-extract.pl\f[R] [\f[I]OPTIONS\f[R]] \f[I]document.mmz\f[R]
 .PP
-\f[B]memoize-extract.pl\f[R] [\f[I]OPTIONS\f[R]] \f[I]document.mmz\f[R]
-.PP
-\f[B]memoize-extract.py\f[R] [\f[I]OPTIONS\f[R]] \f[I]document.mmz\f[R]
+\f[B]memoize\-extract.py\f[R] [\f[I]OPTIONS\f[R]] \f[I]document.mmz\f[R]
 .SH DESCRIPTION
-.PP
-\f[B]memoize-extract\f[R] is a script accompanying Memoize, a TeX
+\f[B]memoize\-extract\f[R] is a script accompanying Memoize, a TeX
 package which allows the author to reuse the results of
-compilation-intensive code such as TikZ pictures.
+compilation\-intensive code such as TikZ pictures.
 .PP
 Memoize dumps the created externs (boxes containing the typeset material
 to be reused) onto their own pages in the produced PDF file.
-It is the job of \f[B]memoize-extract\f[R] to extract these extern pages
-into separate PDF files.
+It is the job of \f[B]memoize\-extract\f[R] to extract these extern
+pages into separate PDF files.
 At subsequent compilations, Memoize will include those extern files into
 the document, without compiling their source again.
 .PP
-Memoize communicates with \f[B]memoize-extract\f[R] through file
+Memoize communicates with \f[B]memoize\-extract\f[R] through file
 \f[I]document.mmz\f[R].
 When \f[I]document.tex\f[R] is compiled to produce
 \f[I]document.pdf\f[R], Memoize produces \f[I]document.mmz\f[R], which
@@ -45,7 +27,7 @@
 records which pages in the produced document are extern pages and to
 which extern files they should be extracted.
 Therefore, after compiling \f[I]document.tex\f[R], the externs should be
-extracted by \f[B]memoize-extract\f[R] \f[I]document.mmz\f[R].
+extracted by \f[B]memoize\-extract\f[R] \f[I]document.mmz\f[R].
 .PP
 \f[I]document.mmz\f[R] may also be given as document* or
 \f[I]document.tex\f[R].
@@ -54,65 +36,70 @@
 .PP
 \f[I]document.mmz\f[R] also records the expected width and height of
 each extern.
-In case of a mismatch, \f[B]memoize-extract\f[R] refuses to extract the
+In case of a mismatch, \f[B]memoize\-extract\f[R] refuses to extract the
 page and removes the extern file if it already exist, and prints a
 warning message to the standard error.
-The script also refuses to extract the page if a (c)c-memo associated to
-the extern does not exist.
+The script also refuses to extract the page if a (c)c\-memo associated
+to the extern does not exist.
 See also section SECURITY.
 .PP
 The Perl (.pl) and the Python (.py) version of the script are
 functionally equivalent.
-The Perl script requires library
-PDF::API2 (https://metacpan.org/pod/PDF::API2), and the Python script
-requires library pdfrw2 (https://pypi.org/project/pdfrw2).
+The Perl script requires library \c
+.UR https://metacpan.org/pod/PDF::API2
+PDF::API2
+.UE \c
+, and the Python script requires library \c
+.UR https://pypi.org/project/pdfrw2
+pdfrw2
+.UE \c
+\&.
 .SH OPTIONS
 .TP
-\f[B]-P, --pdf\f[R] \f[I]filename.pdf\f[R]
+\f[B]\-P, \-\-pdf\f[R] \f[I]filename.pdf\f[R]
 The externs will be extracted from \f[I]filename.pdf\f[R].
 By default, they are extracted from \f[I]document.pdf\f[R].
 .TP
-\f[B]-p, --prune\f[R]
+\f[B]\-p, \-\-prune\f[R]
 Remove the extern pages from the PDF after extraction.
 .TP
-\f[B]-k, --keep\f[R]
+\f[B]\-k, \-\-keep\f[R]
 Do not modify the \f[I]document.mmz\f[R] to mark the externs as
 extracted.
 By default, they are commented out to prevent double extraction.
 .TP
-\f[B]-F, --format\f[R] \f[I]latex\f[R]|\f[I]plain\f[R]|\f[I]context\f[R]
+\f[B]\-F, \-\-format\f[R] \f[I]latex\f[R]|\f[I]plain\f[R]|\f[I]context\f[R]
 When this option is given, the script assumes that it was called from
 within a TeX compilation of a document in the given format: it prefixes
 all output by the script name, and creates a log file
-\f[I]document.mmz.log\f[R], which receives any extraction-related
+\f[I]document.mmz.log\f[R], which receives any extraction\-related
 warnings and errors.
 .TP
-\f[B]-f, --force\f[R]
-Extract the extern even if the size-check fails.
+\f[B]\-f, \-\-force\f[R]
+Extract the extern even if the size\-check fails.
 .TP
-\f[B]-q, --quiet\f[R]
+\f[B]\-q, \-\-quiet\f[R]
 Don\[cq]t describe what\[cq]s happening.
 .TP
-\f[B]-m, --mkdir\f[R]
-A paranoid \f[I]mkdir -p\f[R].
+\f[B]\-m, \-\-mkdir\f[R]
+A paranoid \f[I]mkdir \-p\f[R].
 (No extraction occurs, \f[I]document.mmz\f[R] is interpreted as a
 directory name, which may end in any suffix; no suffix mangling is
 performed.)
 .TP
-\f[B]-V, --version\f[R]
+\f[B]\-V, \-\-version\f[R]
 Show the Memoize version number and exit.
 .TP
-\f[B]-h, --help\f[R]
+\f[B]\-h, \-\-help\f[R]
 Show help and exit.
 .SH SECURITY
-.PP
 This script respects the restrictions on file input and output imposed
 by the TeX configuration, more precisely, the variables
 \f[I]openin_any\f[R] and \f[I]openout_any\f[R] of the \f[B]kpathsea\f[R]
 library (https://tug.org/kpathsea).
 You can inspect the values of these variables by executing
-`\f[B]kpsewhich\f[R] -var-value=openin_any' and `\f[B]kpsewhich\f[R]
--var-value=openout_any'.
+\f[CR]kpsewhich \-var\-value=openin_any\f[R] and
+\f[CR]kpsewhich \-var\-value=openout_any\f[R].
 The interpretation is as follows:
 .TP
 \f[B]a\f[R] (or \f[B]y\f[R] or \f[B]1\f[R]) any
@@ -130,7 +117,7 @@
 \f[B]tlmgr\f[R]) or as an environment variable.
 \f[I]TEXMF_OUTPUT_DIRECTORY\f[R] may only be set as an environment
 variables; it is automatically set by TeX when called by
-\f[I]-output-directory\f[R] option (starting in TeXLive 2024).
+\f[I]\-output\-directory\f[R] option (starting in TeXLive 2024).
 .SH EXIT STATUS
 .TP
 \f[B]0\f[R]
@@ -140,18 +127,21 @@
 .TP
 \f[B]10\f[R]
 A warning also reported back to the compilation when given option
-\f[B]--format\f[R].
-Currently, either: (i) size-mismatch; (ii) a non-existing associated
-(c)c-memo file; or (iii) unavailable \f[I]kpsewhich\f[R].
+\f[B]\-\-format\f[R].
+Currently, either: (i) size\-mismatch; (ii) a non\-existing associated
+(c)c\-memo file; or (iii) unavailable \f[I]kpsewhich\f[R].
 .TP
 \f[B]11\f[R]
 An error also reported back to the compilation when given option
-\f[B]--format\f[R].
-Currently, either: (i) a currupted document PDF, or (ii) a kpathsea
+\f[B]\-\-format\f[R].
+Currently, either: (i) a corrupted document PDF, or (ii) a kpathsea
 permission error.
 .PP
 Other exit codes are as produced by the underlying scripting language
 (Perl of Python).
 .SH SEE ALSO
-.PP
-Memoize manual (https://ctan.org/pkg/memoize), section 6.6.1.
+\c
+.UR https://ctan.org/pkg/memoize
+Memoize manual
+.UE \c
+, section 6.6.1.

Modified: trunk/Master/texmf-dist/doc/man/man1/memoize-extract.man1.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/man/man1/memoize-extract.pl.man1.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/man/man1/memoize-extract.py.man1.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/scripts/memoize/memoize-clean.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/memoize/memoize-clean.pl	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/scripts/memoize/memoize-clean.pl	2024-11-24 20:54:26 UTC (rev 72961)
@@ -19,7 +19,7 @@
 # <texmf>/doc/generic/memoize/FILES.
 
 my $PROG = 'memoize-clean.pl';
-my $VERSION = '2024/04/02 v1.3.0';
+my $VERSION = '2024/11/24 v1.4.0';
 
 use strict;
 use Getopt::Long;

Modified: trunk/Master/texmf-dist/scripts/memoize/memoize-clean.py
===================================================================
--- trunk/Master/texmf-dist/scripts/memoize/memoize-clean.py	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/scripts/memoize/memoize-clean.py	2024-11-24 20:54:26 UTC (rev 72961)
@@ -18,7 +18,7 @@
 # The files belonging to this work and covered by LPPL are listed in
 # <texmf>/doc/generic/memoize/FILES.
 
-__version__ = '2024/04/02 v1.3.0'
+__version__ = '2024/11/24 v1.4.0'
 
 import argparse, re, sys, pathlib, os
 
@@ -111,8 +111,8 @@
 def populate_tbdeleted(folder, basename_prefix):
     re_aux = re.compile(
         re.escape(basename_prefix) + 
-        '[0-9A-F]{32}(?:-[0-9A-F]{32})?'
-        '(?:-[0-9]+)?(?:\.memo|(?:-[0-9]+)?\.pdf|\.log)$')
+        r'[0-9A-F]{32}(?:-[0-9A-F]{32})?'
+        r'(?:-[0-9]+)?(?:\.memo|(?:-[0-9]+)?\.pdf|\.log)$')
     try:
         for f in folder.iterdir():
             if re_aux.match(f.name) and (args.all or f not in keep):

Modified: trunk/Master/texmf-dist/scripts/memoize/memoize-extract.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/memoize/memoize-extract.pl	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/scripts/memoize/memoize-extract.pl	2024-11-24 20:54:26 UTC (rev 72961)
@@ -19,7 +19,7 @@
 # <texmf>/doc/generic/memoize/FILES.
 
 my $PROG = 'memoize-extract.pl';
-my $VERSION = '2024/04/02 v1.3.0';
+my $VERSION = '2024/11/24 v1.4.0';
 
 use strict;
 use File::Basename qw/basename/;

Modified: trunk/Master/texmf-dist/scripts/memoize/memoize-extract.py
===================================================================
--- trunk/Master/texmf-dist/scripts/memoize/memoize-extract.py	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/scripts/memoize/memoize-extract.py	2024-11-24 20:54:26 UTC (rev 72961)
@@ -18,7 +18,7 @@
 # The files belonging to this work and covered by LPPL are listed in
 # <texmf>/doc/generic/memoize/FILES.
 
-__version__ = '2024/04/02 v1.3.0'
+__version__ = '2024/11/24 v1.4.0'
 
 import argparse, re, sys, os, subprocess, itertools, traceback, platform
 from pathlib import Path, PurePath

Modified: trunk/Master/texmf-dist/source/generic/memoize/Makefile
===================================================================
--- trunk/Master/texmf-dist/source/generic/memoize/Makefile	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/source/generic/memoize/Makefile	2024-11-24 20:54:26 UTC (rev 72961)
@@ -10,10 +10,10 @@
 # Prepare the CTAN submission.
 
 PACKAGE = memoize
-VERSION = 1.3.0
+VERSION = 1.4.0
 YEAR = 2024
-MONTH = 04
-DAY = 02
+MONTH = 11
+DAY = 24
 
 FORMAT = generic
 
@@ -20,7 +20,7 @@
 COMMON = memoize nomemoize memoizable
 PLAIN = memoize-extract-one.tex
 GENERIC = memoizable.code.tex
-LATEX = memoize-biblatex.code.tex
+LATEX = memoize-biblatex.code.tex memoize-beamer.code.tex
 SOURCE = memoize.edtx memoize.ins
 
 SCRIPTS := memoize-extract memoize-clean
@@ -37,20 +37,20 @@
 README = doc/README.memoize.md
 INSTALL = INSTALL.md
 CHANGELOG = CHANGELOG.md
-MAKEFILE = Makefile
+MAKEFILE = Makefile Makefile.package Makefile.runtimes Makefile.advice Makefile.collargs
 LICENCE = LICENCE
 
 PACKAGES.edtx = $(PACKAGES:%=%.edtx)
+PACKAGES.dtx = $(PACKAGES:%=%.dtx)
 PACKAGES.ins = $(PACKAGES:%=%.ins)
 
-makefiles = Makefile.package Makefile.runtimes Makefile.advice Makefile.collargs 
-
 codedoc-source = memoize-code.tex \
-                 memoize-code.sty memoize-doc-common.sty
+                 memoize-code.sty memoize-doc-common.sty \
+		 memoize-code.latexmkrc
 
 manual-source = memoize-doc.tex \
                 memoize-doc.sty memoize-doc-common.sty yadoc.sty \
-		memoize-doc.mst
+		memoize-doc.mst memoize-doc.latexmkrc
 
 PDF = memoize-doc.pdf memoize-code.pdf
 
@@ -57,31 +57,19 @@
 codedoc-source := $(codedoc-source:%=doc/%)
 manual-source := $(manual-source:%=doc/%)
 pdf := $(PDF:%=doc/%)
-DOC = $(sort $(codedoc-source) $(manual-source)) $(pdf) $(man-src)
+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)
+	$(MAKE) -C doc/examples examples-src.zip
 
-# doc/attachments.lst is produced by compiling memoize.tex (without memoization).
-# doc-examples will hold soft links to the relevant generated example files.
-doc-examples := $(shell sed 's/^.* \(.*\) ##.*$$/\1/' doc/attachments.lst)
-doc-examples := $(doc-examples:%=doc/examples/%)
+doc/examples.zip: $(examples-src)
+	$(MAKE) -C doc/examples examples.zip
 
 ctan/$(PACKAGE).zip:
 	$(TDS-BEGIN)
-#	Check for duplicate filenames:
-	echo $(doc-examples) | tr ' ' '\n' | uniq -d | ifne false
-	cd doc && zip ../$(TDS-DOC-DIR)/examples-src.zip $(examples-src:doc/%=%)
-#	For each line ($1 $2) in attachments.lst, link $1 to $2 ...
-	cd doc/examples && sed 's!^examples/!ln -sfr !' ../attachments.lst | sh
-#	... and zip those links.
-	cd doc && zip -r ../$(TDS-DOC-DIR)/examples.zip $(doc-examples:doc/%=%)
 	$(TDS-END)
 	$(CTAN-BEGIN)
-	ln -sr $(TDS-DOC-DIR)/examples-src.zip $(CTAN-DIR)/doc
-	ln -sr $(TDS-DOC-DIR)/examples.zip $(CTAN-DIR)/doc
 	$(CTAN-END)
 
 %.py.dtx: %.py
@@ -93,20 +81,20 @@
 		| sed -e '/^% Local Variables:/Q' > $@
 
 doc/memoize-code.pdf: $(codedoc-source) \
-                      $(PACKAGES.edtx) $(PACKAGES.ins) $(SCRIPTS:%=%.dtx)
+                      $(PACKAGES.dtx) $(PACKAGES.ins) $(SCRIPTS:%=%.dtx)
 
-doc/memoize.pdf: $(manual-source) $(examples-src) $(PACKAGES.edtx)
+doc/memoize-doc.pdf: $(manual-source) $(PACKAGES.edtx) doc/examples.zip
 
 %.pdf: %.tex
-	latexmk -cd -lualatex -bibtex- $(LATEXMK) $<  && touch $@
+	latexmk -r $*.latexmkrc $(LATEXMK) $<
 
 
 
-# Maintanence
+# Maintenance
 
 test.tex = $(wildcard test*.tex)
 
-.PHONY: all runtime force clean versions-show
+.PHONY: all force clean versions-show
 
 .PRECIOUS: %.1
 
@@ -131,12 +119,14 @@
 	$(call EDIT-VERSION-MAN,doc/memoize-extract.1.md)
 	$(call EDIT-VERSION-MAN,doc/memoize-clean.1.md)
 	$(call EDIT-DATE-CHANGELOG,CHANGELOG.md)
+	$(call EDIT-VERSION-LATEX,doc/memoize-doc.tex,memoize)
+	$(call EDIT-VERSION-LATEX,doc/memoize-code.tex,memoize)
 define COLOR_VERSION
 grep -E --color '[0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2}|v?[0-9]\.[0-9]\.[0-9]([-a-z]*)|(January|February|March|April|May|June|July|August|September|October|November|December) [0-9]+, [0-9]{4}'
 endef
 
 versions-show:
-	@grep -E '%<latex>\\ProvidesPackage|^%<context>%D\s*(version|date)=' $(PACKAGES.edtx) | ${COLOR_VERSION}
+	@grep -E '\\ProvidesPackage|^%<context>%D\s*(version|date)=' $(PACKAGES.edtx) $(pdf:%.pdf=%.tex) | ${COLOR_VERSION}
 	@grep __version__ *.py | ${COLOR_VERSION}
 	@grep VERSION *.pl | ${COLOR_VERSION}
 	@grep -E '^(footer|date):' doc/memoize-*.md | ${COLOR_VERSION}
@@ -147,7 +137,7 @@
 
 VERSION-MAN = of Memoize v$(VERSION)
 
-.PHONY: all-runtimes link-all-runtimes unlink-all-runtimes test
+.PHONY: all-runtimes link-all-runtimes install-all-runtimes unlink-all-runtimes test examples
 
 all-runtimes: runtimes
 	$(MAKE) -f Makefile.advice runtimes
@@ -157,9 +147,13 @@
 	$(MAKE) -f Makefile.advice link-runtimes
 	$(MAKE) -f Makefile.collargs link-runtimes
 
-unlink-all-runtimes: unlink-runtimes
-	$(MAKE) -f Makefile.advice unlink-runtimes
-	$(MAKE) -f Makefile.collargs unlink-runtimes
+install-all-runtimes: install-runtimes
+	$(MAKE) -f Makefile.advice install-runtimes
+	$(MAKE) -f Makefile.collargs install-runtimes
 
+uninstall-all-runtimes: uninstall-runtimes
+	$(MAKE) -f Makefile.advice uninstall-runtimes
+	$(MAKE) -f Makefile.collargs uninstall-runtimes
+
 test:
 	cd testing && ./MakeTests.py

Added: trunk/Master/texmf-dist/source/generic/memoize/Makefile.advice
===================================================================
--- trunk/Master/texmf-dist/source/generic/memoize/Makefile.advice	                        (rev 0)
+++ trunk/Master/texmf-dist/source/generic/memoize/Makefile.advice	2024-11-24 20:54:26 UTC (rev 72961)
@@ -0,0 +1,40 @@
+# Prepare the CTAN submission.
+
+# This file is indented to be used from Memoize's source directory, which
+# should also contain the files assigned below to SOURCE.
+
+PACKAGE = advice
+VERSION = 1.1.1
+YEAR = 2024
+MONTH = 03
+DAY = 15
+
+FORMAT = generic
+
+COMMON = advice
+GENERIC = advice-tikz.code.tex
+SOURCE = advice.edtx advice.ins
+
+README = doc/README.advice.md
+INSTALL = doc/INSTALL.advice.md
+CHANGELOG = doc/CHANGELOG.advice.md
+MAKEFILE = Makefile.runtimes
+LICENCE = LICENCE
+
+ctan/$(PACKAGE).zip:
+	$(TDS-BEGIN)
+	cd $(TDS-SOURCE-DIR) && mv Makefile.runtimes Makefile
+	$(TDS-END)
+	$(CTAN-BEGIN)
+	cd $(CTAN-DIR) && mv Makefile.runtimes Makefile
+	$(CTAN-END)
+
+version:
+	$(call EDIT-VERSION-LATEX,advice.edtx,advice,$(YEAR)/$(MONTH)/$(DAY) v$(VERSION))
+	$(call EDIT-VERSION-CONTEXT,advice.edtx,$(YEAR)-$(MONTH)-$(DAY),$(VERSION))
+	$(call EDIT-DATE-CHANGELOG,doc/CHANGELOG.advice.md)
+	$(call EDIT-VERSION-LATEX,doc/memoize-doc.tex,advice)
+	$(call EDIT-VERSION-LATEX,doc/memoize-code.tex,advice)
+
+include Makefile.package
+include Makefile.runtimes

Added: trunk/Master/texmf-dist/source/generic/memoize/Makefile.collargs
===================================================================
--- trunk/Master/texmf-dist/source/generic/memoize/Makefile.collargs	                        (rev 0)
+++ trunk/Master/texmf-dist/source/generic/memoize/Makefile.collargs	2024-11-24 20:54:26 UTC (rev 72961)
@@ -0,0 +1,39 @@
+# Prepare the CTAN submission.
+
+# This file is indented to be used from Memoize's source directory, which
+# should also contain collargs.edtx and collargs.ins.
+
+PACKAGE = collargs
+VERSION = 1.2.0
+YEAR = 2024
+MONTH = 03
+DAY = 15
+
+FORMAT = generic
+
+COMMON = collargs
+SOURCE = collargs.edtx collargs.ins
+
+README = doc/README.collargs.md
+INSTALL = doc/INSTALL.collargs.md
+CHANGELOG = doc/CHANGELOG.collargs.md
+MAKEFILE = Makefile.runtimes
+LICENCE = LICENCE
+
+ctan/$(PACKAGE).zip:
+	$(TDS-BEGIN)
+	cd $(TDS-SOURCE-DIR) && mv Makefile.runtimes Makefile
+	$(TDS-END)
+	$(CTAN-BEGIN)
+	cd $(CTAN-DIR) && mv Makefile.runtimes Makefile
+	$(CTAN-END)
+
+version:
+	$(call EDIT-VERSION-LATEX,collargs.edtx,collargs,$(YEAR)/$(MONTH)/$(DAY) v$(VERSION))
+	$(call EDIT-VERSION-CONTEXT,collargs.edtx,$(YEAR)-$(MONTH)-$(DAY),$(VERSION))
+	$(call EDIT-DATE-CHANGELOG,doc/CHANGELOG.collargs.md)
+	$(call EDIT-VERSION-LATEX,doc/memoize-doc.tex,collargs)
+	$(call EDIT-VERSION-LATEX,doc/memoize-code.tex,collargs)
+
+include Makefile.package
+include Makefile.runtimes

Added: trunk/Master/texmf-dist/source/generic/memoize/Makefile.package
===================================================================
--- trunk/Master/texmf-dist/source/generic/memoize/Makefile.package	                        (rev 0)
+++ trunk/Master/texmf-dist/source/generic/memoize/Makefile.package	2024-11-24 20:54:26 UTC (rev 72961)
@@ -0,0 +1,224 @@
+# This Makefile must be included at the end of the including file.
+
+latex = $(COMMON:%=%.sty) $(LATEX)
+plain = $(COMMON:%=%.tex) $(PLAIN)
+context = $(COMMON:%=t-%.tex) $(CONTEXT)
+
+TEX = $(latex) $(plain) $(context) $(GENERIC)
+
+RUNTIME = $(TEX) $(SCRIPTS) $(MAN)
+
+ALL = $(RUNTIME) $(SOURCE) $(DOC) \
+      $(README) $(INSTALL) $(CHANGELOG) $(LICENCE) $(MAKEFILE)
+
+ctan/$(PACKAGE).zip: $(ALL)
+
+CTAN-DIR = ctan/$(PACKAGE)
+CTAN-DOC-DIR = ctan/$(PACKAGE)/doc
+
+format-dir = $(subst context,context/third,$(FORMAT))
+
+TDS-DIR = texmf/$(PACKAGE).tds
+TDS-SCRIPTS-DIR = $(TDS-DIR)/scripts/$(PACKAGE)
+TDS-DOC-DIR = $(TDS-DIR)/doc/$(format-dir)/$(PACKAGE)
+TDS-SOURCE-DIR = $(TDS-DIR)/source/$(format-dir)/$(PACKAGE)
+TDS-MAN-DIR = $(TDS-DIR)/doc/man/man
+TDS-ALL-DIRS = $(TDS-SCRIPTS-DIR) $(TDS-SOURCE-DIR) $(TDS-DOC-DIR) \
+		$(TDS-DIR)/tex/{latex,plain,generic}/$(PACKAGE) \
+		$(TDS-DIR)/tex/context/third/$(PACKAGE) \
+		$(TDS-MAN-DIR){1,2,3,4,5,6,7,8,9}
+
+readme?md = README$(findstring .md, $(suffix $(README)))
+install?md = INSTALL$(findstring .md, $(suffix $(INSTALL)))
+changelog?md = CHANGELOG$(findstring .md, $(suffix $(CHANGELOG)))
+licence?md = LICENCE$(findstring .md, $(suffix $(LICENCE)))
+
+man1 = $(filter %.1,$(MAN))
+man2 = $(filter %.2,$(MAN))
+man3 = $(filter %.3,$(MAN))
+man4 = $(filter %.4,$(MAN))
+man5 = $(filter %.5,$(MAN))
+man6 = $(filter %.6,$(MAN))
+man7 = $(filter %.7,$(MAN))
+man8 = $(filter %.8,$(MAN))
+man9 = $(filter %.9,$(MAN))
+
+define MAKE-CTAN
+	$(CTAN-BEGIN)
+	$(CTAN-END)
+endef
+
+define CTAN-BEGIN
+	rm -rf $(CTAN-DIR) ctan/$(PACKAGE).zip
+	mkdir -p $(CTAN-DIR) $(CTAN-DOC-DIR)
+	$(call cp,$(SOURCE) $(SCRIPTS) $(CTAN),$(CTAN-DIR))
+	$(call cp,$(README),$(CTAN-DIR)/$(readme?md))
+	$(call cp,$(INSTALL),$(CTAN-DIR)/$(install?md))
+	$(call cp,$(CHANGELOG),$(CTAN-DIR)/$(changelog?md))
+	$(call cp,$(LICENCE),$(CTAN-DIR)/$(licence?md))
+	$(call cp,$(MAKEFILE),$(CTAN-DIR))
+	$(call cp,$(DOC),$(CTAN-DOC-DIR))
+endef
+
+define CTAN-END
+	if [[ -d $(TDS-DIR) ]] ; then \
+		cd $(TDS-DIR) && \
+		zip -r $(PACKAGE).tds.zip * ; \
+	fi
+	if [[ -a $(TDS-DIR)/$(PACKAGE).tds.zip ]] ; then \
+		mv $(TDS-DIR)/$(PACKAGE).tds.zip ctan ; \
+	fi
+	rmdir -p --ignore-fail-on-non-empty `find $(CTAN-DIR) -type d`
+	cd ctan && zip -r $(PACKAGE).zip $(PACKAGE) $(PACKAGE).tds.zip
+	cp ctan/$(PACKAGE).zip ctan/$(PACKAGE)-$(YEAR)-$(MONTH)-$(DAY)-v$(VERSION).zip
+endef
+
+define MAKE-TDS
+	$(TDS-BEGIN)
+	$(TDS-END)
+endef
+
+define TDS-BEGIN
+	rm -rf $(TDS-DIR)
+	$(TDS-MKDIR)
+	$(TDS-CP)
+endef
+define TDS-MKDIR
+	mkdir -p $(TDS-ALL-DIRS)
+endef
+define TDS-CP
+	$(call cp,$(latex),$(TDS-DIR)/tex/latex/$(PACKAGE))
+	$(call cp,$(plain),$(TDS-DIR)/tex/plain/$(PACKAGE))
+	$(call cp,$(context),$(TDS-DIR)/tex/context/third/$(PACKAGE))
+	$(call cp,$(GENERIC),$(TDS-DIR)/tex/generic/$(PACKAGE))
+	$(call cp,$(SCRIPTS),$(TDS-SCRIPTS-DIR))
+	$(call cp,$(SOURCE),$(TDS-SOURCE-DIR))
+	$(call cp,$(MAKEFILE),$(TDS-SOURCE-DIR))
+	$(call cp,$(DOC),$(TDS-DOC-DIR))
+	$(call cp,$(README),$(TDS-DOC-DIR)/$(readme?md))
+	$(call cp,$(INSTALL),$(TDS-DOC-DIR)/$(install?md))
+	$(call cp,$(CHANGELOG),$(TDS-DOC-DIR)/$(changelog?md))
+	$(call cp,$(LICENCE),$(TDS-DOC-DIR)/$(licence?md))
+	$(call cp,$(man1),$(TDS-MAN-DIR)1)
+	$(call cp,$(man2),$(TDS-MAN-DIR)2)
+	$(call cp,$(man3),$(TDS-MAN-DIR)3)
+	$(call cp,$(man4),$(TDS-MAN-DIR)4)
+	$(call cp,$(man5),$(TDS-MAN-DIR)5)
+	$(call cp,$(man6),$(TDS-MAN-DIR)6)
+	$(call cp,$(man7),$(TDS-MAN-DIR)7)
+	$(call cp,$(man8),$(TDS-MAN-DIR)8)
+	$(call cp,$(man9),$(TDS-MAN-DIR)9)
+endef
+
+define TDS-END
+	$(TDS-FILES)
+	$(TDS-PRUNE)
+endef
+define TDS-FILES
+	cd $(TDS-DIR) ; find . -type f | sed 's!^\./!!' \
+		> doc/$(format-dir)/$(PACKAGE)/FILES
+endef
+define TDS-PRUNE
+	rmdir -p --ignore-fail-on-non-empty `find $(TDS-DIR) -type d`
+endef
+
+%.1: %.1.md
+	pandoc $< -s -t man -o $@
+%.2: %.2.md
+	pandoc $< -s -t man -o $@
+%.3: %.3.md
+	pandoc $< -s -t man -o $@
+%.4: %.4.md
+	pandoc $< -s -t man -o $@
+%.5: %.5.md
+	pandoc $< -s -t man -o $@
+%.6: %.6.md
+	pandoc $< -s -t man -o $@
+%.7: %.7.md
+	pandoc $< -s -t man -o $@
+%.8: %.8.md
+	pandoc $< -s -t man -o $@
+%.9: %.9.md
+	pandoc $< -s -t man -o $@
+
+.PHONY: runtimes link-runtimes install-runtimes uninstall-runtimes version
+.IGNORE: uninstall-runtimes
+
+cp=$(intcmp $(words $(1)),0,,,cp $(1) $(2))
+
+runtimes: $(RUNTIME)
+
+TEXMFHOME=$(shell kpsewhich -var-value TEXMFHOME)
+
+link-runtimes:
+	$(eval TDS-DIR=$(TEXMFHOME))
+	$(eval cp=$$(intcmp $$(words $$(1)),0,,,ln -srf $$(1) $$(2)))
+	$(TDS-MKDIR)
+	$(TDS-CP)
+	$(TDS-PRUNE)
+	texconfig rehash
+
+install-runtimes:
+	$(eval TDS-DIR=$(TEXMFHOME))
+	$(TDS-MKDIR)
+	$(TDS-CP)
+	$(TDS-PRUNE)
+	texconfig rehash
+
+uninstall-runtimes:
+	$(eval TDS-DIR=$(TEXMFHOME))
+	$(eval cp=$$(intcmp $$(words $$(1)),0,,,\
+		if [[ -d $$(2) ]] ; then rm -f $$(foreach f,$$(1),$$(2)/$$(notdir $$(f))) ; \
+		else rm -f $$(2) ; fi \
+	))
+	$(TDS-CP)
+	$(TDS-PRUNE)
+	texconfig rehash
+
+
+# $1 = source file, $2 = package name
+VERSION-LATEX = $(YEAR)/$(MONTH)/$(DAY) v$(VERSION)
+define EDIT-VERSION-LATEX
+	sed -Ei 's!\\ProvidesPackage\{$(2)\}\[[0-9]{4}/[0-9]{1,2}/[0-9]{1,2} v[-0-9.a-z]* !\\ProvidesPackage{$(2)}[$(VERSION-LATEX) !' $(1)
+endef
+
+# $1 = source file
+# This assumes that all the \modules in the file have the same date and version.
+VERSION-CONTEXT = $(VERSION)
+DATE-CONTEXT = $(YEAR)-$(MONTH)-$(DAY)
+define EDIT-VERSION-CONTEXT
+	sed -Ei 's!(%D *version=)[-0-9.a-z]*,!\1$(VERSION-CONTEXT),!;s!(%D *date=)[-0-9]*,!\1$(DATE-CONTEXT),!' $(1)
+endef
+
+# $1 = source .pl file, $2 = version
+VERSION-PERL = $(YEAR)/$(MONTH)/$(DAY) v$(VERSION)
+define EDIT-VERSION-PERL
+	sed -i "s!^my \$$VERSION = .*!my \$$VERSION = '$(VERSION-PERL)';!" $(1)
+endef
+
+# $1 = source .py file, $2 = version
+VERSION-PYTHON = $(YEAR)/$(MONTH)/$(DAY) v$(VERSION)
+define EDIT-VERSION-PYTHON
+	sed -i "s!^__version__ = .*!__version__ = '$(VERSION-PYTHON)'!" $(1)
+endef
+
+# $1 = source file
+VERSION-MAN = $(VERSION)
+DATE-MAN = $(shell LANG=en date -d '$(YEAR)-$(MONTH)-$(DAY)' +"%B %d, %Y")
+# This assumes that the source filename is file.<N>.md, because it strips away two suffixes.
+define EDIT-VERSION-MAN
+	sed -i '/^date:/c date: $(DATE-MAN)' $(1)
+	sed -i '/^footer:/c footer: $(basename $(basename $(notdir $(1)))) $(VERSION-MAN)' $(1)
+endef
+
+# $1 = source file, $2 = package name
+VERSION-PLAIN = $(VERSION-LATEX)
+define EDIT-VERSION-PLAIN
+		sed -Ei 's!^(%<[^\>]*>% Package $(2) ).*!\1$(VERSION-PLAIN)!' $(1)
+endef
+
+# Change the date of the latest release (identified by the version) of the package.
+define EDIT-DATE-CHANGELOG
+	sed -Ei 's!^(#+|Manual: Memoize) [0-9]{4}/[0-9]{1,2}/[0-9]{1,2} +v$(VERSION)!\1 $(YEAR)/$(MONTH)/$(DAY) v$(VERSION)!' $(1)
+endef
+

Added: trunk/Master/texmf-dist/source/generic/memoize/Makefile.runtimes
===================================================================
--- trunk/Master/texmf-dist/source/generic/memoize/Makefile.runtimes	                        (rev 0)
+++ trunk/Master/texmf-dist/source/generic/memoize/Makefile.runtimes	2024-11-24 20:54:26 UTC (rev 72961)
@@ -0,0 +1,8 @@
+.PRECIOUS: %.dtx
+
+%.dtx: %.edtx
+	edtx2dtx $< > $@
+
+%.sty %.tex t-%.tex &: %.ins %.dtx
+	tex $<
+	sed -i -s -e 's/\\\(un\)\?expanded/\\normal\1expanded/g;' t-$*.tex

Modified: trunk/Master/texmf-dist/source/generic/memoize/memoize.edtx
===================================================================
--- trunk/Master/texmf-dist/source/generic/memoize/memoize.edtx	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/source/generic/memoize/memoize.edtx	2024-11-24 20:54:26 UTC (rev 72961)
@@ -1,4 +1,4 @@
-% memoize.edtx (this is not a .dtx file; to produce a .dtx, process it with edtx2dtx)
+% Memoize.edtx (this is not a .dtx file; to produce a .dtx, process it with edtx2dtx)
 % 
 %% This file is a part of Memoize, a TeX package for externalization of
 %% graphics and memoization of compilation results in general, available at
@@ -90,14 +90,14 @@
 % 
 % \paragraph{Identification} of |memoize|, |memoizable| and |nomemoize|.
 %<*mmz>
-%<latex>\ProvidesPackage{memoize}[2024/04/02 v1.3.0 Fast and flexible externalization]
+%<latex>\ProvidesPackage{memoize}[2024/11/24 v1.4.0 Fast and flexible externalization]
 %<context>%D \module[
 %<context>%D         file=t-memoize.tex,
-%<context>%D      version=1.3.0,
+%<context>%D      version=1.4.0,
 %<context>%D        title=Memoize,
 %<context>%D     subtitle=Fast and flexible externalization,
 %<context>%D       author=Saso Zivanovic,
-%<context>%D         date=2024-04-02,
+%<context>%D         date=2024-11-24,
 %<context>%D    copyright=Saso Zivanovic,
 %<context>%D      license=LPPL,
 %<context>%D ]
@@ -104,17 +104,17 @@
 %<context>\writestatus{loading}{ConTeXt User Module / memoize}
 %<context>\unprotect
 %<context>\startmodule[memoize]
-%<plain>% Package memoize 2024/04/02 v1.3.0
+%<plain>% Package memoize 2024/11/24 v1.4.0
 %</mmz>
 %<*mmzable>
-%<latex>\ProvidesPackage{memoizable}[2024/04/02 v1.3.0 A programmer's stub for Memoize]
+%<latex>\ProvidesPackage{memoizable}[2024/11/24 v1.4.0 A programmer's stub for Memoize]
 %<context>%D \module[
 %<context>%D         file=t-memoizable.tex,
-%<context>%D      version=1.3.0,
+%<context>%D      version=1.4.0,
 %<context>%D        title=Memoizable,
 %<context>%D     subtitle=A programmer's stub for Memoize,
 %<context>%D       author=Saso Zivanovic,
-%<context>%D         date=2024-04-02,
+%<context>%D         date=2024-11-24,
 %<context>%D    copyright=Saso Zivanovic,
 %<context>%D      license=LPPL,
 %<context>%D ]
@@ -121,17 +121,17 @@
 %<context>\writestatus{loading}{ConTeXt User Module / memoizable}
 %<context>\unprotect
 %<context>\startmodule[memoizable]
-%<plain>% Package memoizable 2024/04/02 v1.3.0
+%<plain>% Package memoizable 2024/11/24 v1.4.0
 %</mmzable>
 %<*nommz>
-%<latex>\ProvidesPackage{nomemoize}[2024/04/02 v1.3.0 A no-op stub for Memoize]
+%<latex>\ProvidesPackage{nomemoize}[2024/11/24 v1.4.0 A no-op stub for Memoize]
 %<context>%D \module[
 %<context>%D         file=t-nomemoize.tex,
-%<context>%D      version=1.3.0,
+%<context>%D      version=1.4.0,
 %<context>%D        title=Memoize,
 %<context>%D     subtitle=A no-op stub for Memoize,
 %<context>%D       author=Saso Zivanovic,
-%<context>%D         date=2024-04-02,
+%<context>%D         date=2024-11-24,
 %<context>%D    copyright=Saso Zivanovic,
 %<context>%D      license=LPPL,
 %<context>%D ]
@@ -138,7 +138,7 @@
 %<context>\writestatus{loading}{ConTeXt User Module / nomemoize}
 %<context>\unprotect
 %<context>\startmodule[nomemoize]
-%<mmz>% Package nomemoize 2024/04/02 v1.3.0
+%<mmz>% Package nomemoize 2024/11/24 v1.4.0
 %</nommz>
 % 
 % \paragraph{Required packages} and \hologo{LaTeX}ization of \hologo{plainTeX}
@@ -955,11 +955,14 @@
   \ifmemoizing
   \else
     \ifmemoize
-      % Compute \meta{code md5sum} off of the first argument, and globally
+      % Compute \meta{code md5sum} off of the salted source code, and globally
       % store it into |\mmz at code@mdfivesum| --- globally, because we need it in
       % utilization to include externs, but the |\Memoize| group is closed (by
-      % |\mmzMemo|) while inputting the cc-memo.  
-      \xdef\mmz at code@mdfivesum{\pdf at mdfivesum{\the\mmz at mdfive@source}}%
+      % |\mmzMemo|) while inputting the cc-memo.
+      \xdef\mmz at code@mdfivesum{\pdf at mdfivesum{%
+          \expanded{\the\mmzSalt}%
+          \the\mmz at mdfive@source
+        }}%
       \mmz at trace@code at mdfive
       % Recompile mode forces memoization.
       \ifnum\mmz at mode=\mmz at mode@recompile\relax
@@ -1251,7 +1254,7 @@
 %   extern-inclusion code to the cc-memo, and (v) puts the box into the
 %   document (again prefixing it with |\quitvmode| if necessary).  (The listing
 %   region markers help us present this code in the manual.)
-%   \begin{listingregion}{single-extern-driver.tex}
+%   \begin{listingregion}{single-extern-driver}
 \long\def\mmzSingleExternDriver#1{%
   \xtoksapp\mmzCCMemo{\mmz at maybe@quitvmode}%
   \setbox\mmz at box\mmz at capture{#1}%
@@ -1480,17 +1483,50 @@
   %   /handlers/.value to context}
   %   Utilities to put the meaning of various stuff into |context|.
   %   \indentmacrocode
-  meaning to context/.code={\forcsvlist\mmz at mtoc{#1}},
-  csname meaning to context/.code={\mmz at mtoc@csname{#1}},
-  key meaning to context/.code={%
+  meaning to context/.code={\mmz at Cos\forcsvlist\mmz at mtoc{#1}},
+  csname meaning to context/.code={\mmz at Cos\mmz at mtoc@csname{#1}},
+  key meaning to context/.code={\mmz at Cos
     \forcsvlist\mmz at mtoc\mmz at mtoc@keycmd{#1}},
-  key value to context/.code={\forcsvlist\mmz at mtoc@key{#1}},
-  /handlers/.meaning to context/.code={\expanded{%
+  key value to context/.code={\mmz at Cos\forcsvlist\mmz at mtoc@key{#1}},
+  /handlers/.meaning to context/.code={\mmz at Cos\expanded{%
       \noexpand\mmz at mtoc@csname{pgfk@\pgfkeyscurrentpath/. at cmd}}},
-  /handlers/.value to context/.code={%
+  /handlers/.value to context/.code={\mmz at Cos
     \expanded{\noexpand\mmz at mtoc@csname{pgfk@\pgfkeyscurrentpath}}},
 }
+% \begin{macro}{\mmzSalt}
+%   \begin{key}{salt, clear salt, meaning to salt, csname meaning to salt, 
+%     key meaning to salt, key value to salt, 
+%     /handlers/.meaning to salt, /handlers/.value to salt}
+%     Salt functions in the same way as context outside memoization, but it
+%     contributes to the source code hash, i.e.\ |\mmzSalt| is expanded when
+%     computing |\mmz at code@mdfivesum| in |\Memoize|.  It was realized that it
+%     is needed for full Beamer support,
+%     see \href{https://github.com/sasozivanovic/memoize/issues/27}{GitHub
+%     issue \#27}.
+\newtoks\mmzSalt
+\mmzset{
+  salt/.code=\expandafter\toksapp\expandafter\mmzSalt{#1,},
+  clear salt/.value forbidden,
+  clear salt/.code=\mmzSalt{},
+  meaning to salt/.code={\mmz at coS\forcsvlist\mmz at mtoc{#1}},
+  csname meaning to salt/.code={\mmz at coS\mmz at mtoc@csname{#1}},
+  key meaning to salt/.code={\mmz at coS
+    \forcsvlist\mmz at mtoc\mmz at mtoc@keycmd{#1}},
+  key value to salt/.code={\mmz at coS
+    \forcsvlist\mmz at mtoc@key{#1}},
+  /handlers/.meaning to salt/.code={\mmz at coS\expanded{%
+      \noexpand\mmz at mtoc@csname{pgfk@\pgfkeyscurrentpath/. at cmd}}},
+  /handlers/.value to salt/.code={\mmz at coS
+    \expanded{\noexpand\mmz at mtoc@csname{pgfk@\pgfkeyscurrentpath}}},
+}
+% \end{key}
+% \end{macro}
+% 
+% The following macros are shared between context and salt, so they should be
+% preceded by either |\mmz at Cos| (for context) or |\mmz at coS| (for salt).
 % \noindentmacrocode
+\def\mmz at Cos{\def\mmz at context@or at salt{context}}
+\def\mmz at coS{\def\mmz at context@or at salt{salt}}
 \def\mmz at mtoc#1{%
   \collargs at cs@cases{#1}%
     {\mmz at mtoc@cmd{#1}}%
@@ -1512,14 +1548,17 @@
   \expandafter\mmz at mtoc@csname\expandafter{\string#1}%
 }
 \def\mmz at mtoc@csname#1{%
-  \pgfkeysvalueof{/mmz/context/. at cmd}%
-  \detokenize{#1}={\expandafter\meaning\csname#1\endcsname}%
+  \pgfkeysvalueof{/mmz/\mmz at context@or at salt/. at cmd}%
+  \detokenize{#1}%
+  \ifcsname#1\endcsname
+    ={\expandafter\meaning\csname#1\endcsname}%
+  \fi
   \pgfeov
 }
 \def\mmz at mtoc@key#1{\mmz at mtoc@csname{pgfk@#1}}
 \def\mmz at mtoc@keycmd#1{\mmz at mtoc@csname{pgfk@#1/. at cmd}}
 \def\mmz at mtoc@error at notcsorenv#1{%
-  \PackageError{memoize}{'\detokenize{#1}' passed to key 'meaning to context'
+  \PackageError{memoize}{'\detokenize{#1}' passed to key 'meaning to \mmz at context@or at salt'
     is neither a command nor an environment}{}%
 }
 % \end{key}
@@ -1770,6 +1809,14 @@
     \fi
     \mmz at trace@resource{#1}%
   \fi
+  % Map the extern sequential number to the path to the extern.  We need this
+  % so that |prefix| can be changed via |\mmznext|.  The problem is that when a
+  % cc-memo is utilized, |\mmzMemo| closes the Memoize group; the |prefix| is
+  % thereby forgotten.  But at the point of execution of |\mmzResource|, the
+  % |prefix| setting is still known and can be baked into
+  % |\mmz at resource@<seq>|, which will be inspected by |\mmzIncludeExtern|.
+  \csxdef{mmz at resource@\the\mmz at seq}{\mmz at prefix@dir#1}%
+  \global\advance\mmz at seq1
 }
 % \end{macro}
 % 
@@ -1830,6 +1877,8 @@
       }%
     \fi
   }%
+  % Reset |\mmz at seq| for |\mmzResorce|.
+  \global\mmz at seq=0
   % Input the cc-memo if it exists.
   \IfFileExists{\mmz at ccmemo@path}{%
     \ifmmz at direct@ccmemo at input
@@ -2099,6 +2148,7 @@
     }%
   }%
   %</context>
+  \mmz at shipout@unrotate
   % 
   % We complete the page setup by setting the content offset.
   \hoffset\dimexpr\mmz at padding@left - \pdfhorigin\relax
@@ -2198,7 +2248,25 @@
     \edef\mmz at inverse@mag{\expandafter\mmz at Pgf@geT\the\dimexpr 1000pt/\mag}%
   }}
 % \end{macro}
+%
 % 
+% \begin{macro}{\mmz at shipout@unrotate}
+%   Remove any rotation attribute given to the PDF page.  I don't know enough
+%   about PDF page attributes to be sure this works in general.  I have tested
+%   the code on simple documents with \hologo{LaTeX} and \hologo{plainTeX} in
+%   \hologo{TeX}live 2023 and 2024.  It seems that the ``unrotation'' is
+%   unnecessary with \hologo{LaTeX3}'s PDF management module (activated by
+%   |\DocumentMetadata{}| before the document class declaration).
+\ifdef\XeTeXversion{%
+  \def\mmz at shipout@unrotate{}%
+}{%
+  \def\mmz at shipout@unrotate{%
+    %<latex>\IfPDFManagementActiveTF{}{\pdfpageattr{/Rotate 0}}%
+    %<plain,context>\pdfpageattr{/Rotate 0}%
+  }%
+}
+% \end{macro}
+% 
 % \begin{macro}{\mmzRegularPages}
 %   This counter holds the number of pages shipped out by the format's shipout
 %   routine.  \hologo{LaTeX} and \hologo{ConTeXt} keep track of this in
@@ -2237,14 +2305,18 @@
 % 
 % \begin{macro}{\mmz at include@extern}
 %   This macro, called from cc-memos as |\mmzIncludeExtern|, inserts an extern
-%   file into the document.  |#1| is the sequential number, |#2| is either
-%   |\hbox| or |\vbox|, |#3|, |#4| and |#5| are the (expected) width, height
-%   and the depth of the externalized box; |#6|--|#9| are the paddings (left,
-%   bottom, right, and top).
-\def\mmz at include@extern#1#2#3#4#5#6#7#8#9{%
-  % Set the extern sequential number, so that we open the correct extern file
-  % (|\mmz at extern@basename|).
-  \mmz at seq=#1\relax
+%   file into the document.  We first look up the path to the extern based on
+%   the extern sequential number; the dictionary was set up by |\mmzResource|
+%   statements in the cc-memo.
+\def\mmz at include@extern#1{%
+  \expandafter\expandafter\expandafter\mmz at include@extern at i
+  \expandafter\expandafter\expandafter{%
+    \csname mmz at resource@#1\endcsname}%
+}
+% |#1| is the path to the extern filename, |#2| is either |\hbox| or |\vbox|,
+% |#3|, |#4| and |#5| are the (expected) width, height and the depth of the
+% externalized box; |#6|--|#9| are the paddings (left, bottom, right, and top).
+\def\mmz at include@extern at i#1#2#3#4#5#6#7#8#9{%
   % Use the primitive PDF graphics inclusion commands to include the extern
   % file.  Set the correct depth or the resulting box, and shift it as
   % specified by the padding.
@@ -2253,7 +2325,7 @@
       \lower\dimexpr #5+#7\relax\hbox{%
         \hskip -#6\relax
         \setbox0=\hbox{%
-          \mmz at insertpdfpage{\mmz at extern@path}{1}%
+          \mmz at insertpdfpage{#1}{1}%
         }%
         \unhbox0
       }%
@@ -2792,7 +2864,7 @@
 \mmzset{
   tex extraction command/.initial=pdftex,
   tex extraction options/.initial={%
-%   \begin{listingregion}{tex-extraction-options.tex}
+%   \begin{listingregion}{tex-extraction-options}
     -halt-on-error
     -interaction=batchmode
     -jobname "\externbasepath"
@@ -2799,7 +2871,7 @@
 % \end{listingregion}
   },
   tex extraction script/.initial={%
-%   \begin{listingregion}{tex-extraction-script.tex} ^^A todo: context
+%   \begin{listingregion}{tex-extraction-script} ^^A todo: context
     \def\noexpand\fromdocument{\jobname.pdf}%
     \def\noexpand\pagenumber{\pagenumber}%
     \def\noexpand\expectedwidth{\expectedwidth}%
@@ -3024,7 +3096,7 @@
 % We cheat and let the |run conditions| do the work --- it is cheaper to just
 % always abort than to invoke the outer handler.  (As we don't set
 % |\AdviceRuntrue|, the run conditions will never be satisfied.)
-% \begin{listingregion}{_auto-abort.tex}
+% \begin{listingregion}{_auto-abort}
 \mmzset{
   auto/abort/.style={run conditions=\mmzAbort},
 }
@@ -3052,7 +3124,7 @@
 %     These run conditions are used by |memoize| and |noop|: Memoize should be
 %     enabled, but we should not be already within Memoize, i.e.\ memoizing or
 %     normally compiling some code submitted to memoization.
-%     \begin{listingregion}{_auto-run-if-memoization-is-possible.tex}
+%     \begin{listingregion}{_auto-run-if-memoization-is-possible}
 \def\mmz at auto@rc at if@memoization at possible{%
   \ifmemoize
     \ifinmemoize
@@ -3095,7 +3167,7 @@
 %     option application local, the outer handler opens a group, which is
 %     expected to be closed by the inner handler.  This key is used by
 %     |memoize| and |noop command|.
-%     \begin{listingregion}{_auto-memoize-outer.tex}
+%     \begin{listingregion}{_auto-memoize-outer}
 \def\mmz at auto@outer{%
   \begingroup
   \mmzAutoInit
@@ -3102,7 +3174,7 @@
   \AdviceCollector
 }
 % \end{listingregion}
-% \begin{listingregion}{_auto-memoize-bailout.tex}
+% \begin{listingregion}{_auto-memoize-bailout}
 \def\mmz at auto@bailout{%
   \mmznext{}%
 }
@@ -3153,7 +3225,7 @@
 %     executing |\Memoize| closes the memoization group and we lose the current
 %     value of |\ifmmz at ignorespaces|.  (We also can't use |\aftergroup|,
 %       because closing the group is not the final thing |\Memoize| does.)
-%       \begin{listingregion}{_auto-memoize-inner.tex}
+%       \begin{listingregion}{_auto-memoize-inner}
 \long\def\mmz at auto@memoize#1{%
   \expanded{%
     \noexpand\Memoize
@@ -3259,13 +3331,11 @@
 % indexing.  Note that the latter is a straightforward instance of replication.
 % 
 %<*latex>
-% \begin{listingregion}{_auto-memoize-ref.tex}
 \mmzset{
   auto/.cd,
   ref/.style={outer handler=\mmz at auto@ref\mmzNoRef, run if memoizing},
   force ref/.style={outer handler=\mmz at auto@ref\mmzForceNoRef, run if memoizing},
 }
-% \end{listingregion}
 \mmzset{
   auto=\ref{ref},
   auto=\pageref{ref},
@@ -3292,7 +3362,7 @@
 %   |#1| should be either |\mmzNoRef| or |\mmzForceNoRef|. |#2| will receive
 %   any optional arguments of |\ref| (or |\pageref|, or whatever), and |#3| in
 %   |\mmz at auto@ref at i| is the cross-reference key.
-%   \begin{listingregion}{_auto-memoize-ref.tex}
+%   \begin{listingregion}{_auto-memoize-ref}
 \def\mmz at auto@ref#1#2#{\mmz at auto@ref at i#1{#2}}
 \def\mmz at auto@ref at i#1#2#3{%
   #1{#3}%
@@ -3308,7 +3378,8 @@
 %   appends the reference key to the context.  |\mmzNoRef| only does that if
 %   the reference is defined, otherwise it aborts the memoization.
 \def\mmzForceNoRef#1{%
-  \mmz at mtoc@csname{r@#1}%
+  \mmz at Cos
+  \expandafter\mmz at mtoc@csname\expandafter{\expanded{r@#1}}%
   \ignorespaces
 }
 \def\mmzNoRef#1{%
@@ -3391,6 +3462,22 @@
 % 
 % \section{Support for various classes and packages}
 %
+% As the support for foreign classes and packages is only loaded in
+% |begindocument/before|, any keys defined there are undefined in the preamble,
+% and can only be used in the document body.  We don't want to burden the
+% author with this detail, so we try executing any unknown keys once again at
+% |begindocument/end|.
+\def\mmz at unknown{}
+\mmzset{
+  .unknown/.code={%
+    \eappto\mmz at unknown{,\pgfkeyscurrentkey={#1}}%
+  },
+  begindocument/end/.append code={%
+    \pgfkeyslet{/mmz/.unknown/. at cmd}\undefined
+    \expandafter\pgfkeysalso\expandafter{\mmz at unknown}%
+  },
+}
+% 
 %<*latex>
 \AddToHook{shipout/before}[memoize]{\global\advance\mmzExtraPages-1\relax}
 \AddToHook{shipout/after}[memoize]{\global\advance\mmzExtraPages1\relax}
@@ -3397,12 +3484,19 @@
 \mmzset{auto=\DiscardShipoutBox{
     outer handler=\global\advance\mmzExtraPages1\relax\AdviceOriginal}}
 %</latex>
+% An auxiliary macro for loading the support code |memoize-*.code.tex| from
+% hook |begindocument/before|, where |@| already has catcode `other'.  The
+% |\input| statement should be enclosed in |\mmz at makeatletter| and
+% |\mmz at restoreatcatcode|.
+\def\mmz at makeatletter{%
+  \edef\mmz at restoreatcatcode{\catcode`\noexpand\@\the\catcode`\@\relax}%
+  \catcode`\@=11
+}
 % 
 % Utility macro for clarity below. |#1| is the name of the package which should
 % be loaded (used with \hologo{LaTeX}) and |#2| is the name of the command
 % which should be defined (used with \hologo{plainTeX} and \hologo{ConTeXt})
-% for |#3| to be executed at the beginning of the document.  We make sure that
-% we can use |#1| etc.\ inside |#3|.
+% for |#3| to be executed at the beginning of the document.
 \def\mmz at if@package at loaded#1#2#3{%
   \mmzset{%
     begindocument/before/.append code={%
@@ -3421,6 +3515,8 @@
   %<plain>\pgfpicture
   %<context>\startpgfpicture
 }{%
+  % We have very little code here, so we don't bother introducing
+  % |memoize-pgf.code.tex|.
   \def\mmzPgfAtBeginMemoization{%
     \edef\mmz at pgfpictureid{%
       \the\pgf at picture@serial at count
@@ -3432,15 +3528,13 @@
     }%
     \ifx\mmz at temp=0
     \else
-      \xtoksapp\mmzCCMemo{%
-        \unexpanded{%
-          \global\expandafter\advance\csname pgf at picture@serial at count\endcsname
-        }%
-        \mmz at temp
-      }%
+      \xtoksapp\mmzCCMemo{\noexpand\mmzStepPgfPictureId{\mmz at temp}}%
     \fi
   }%
-  % \begin{listingregion}{_support-pgf.tex}
+  \def\mmzStepPgfPictureId##1{%
+    \global\advance\pgf at picture@serial at count##1\relax
+  }%
+  % \begin{listingregion}{_support-pgf}
   \mmzset{%
     at begin memoization=\mmzPgfAtBeginMemoization,
     at end memoization=\mmzPgfAtEndMemoization,
@@ -3460,7 +3554,7 @@
   \input advice-tikz.code.tex
   % We define and activate the automemoization handlers for the \TikZ; command
   % and environment.
-  % \begin{listingregion}{_support-tikz.tex}
+  % \begin{listingregion}{_support-tikz}
   \mmzset{%
     auto={tikzpicture}{memoize},
     auto=\tikz{memoize, collector=\AdviceCollectTikZArguments},
@@ -3477,7 +3571,7 @@
 % defined using |xparse|, so |args| is unnecessary.
 %<*latex>
 \mmz at if@package at loaded{forest}{\Forest}{%
-  % \begin{listingregion}{_support-forest.tex}
+  % \begin{listingregion}{_support-forest}
   \mmzset{
     auto={forest}{memoize},
     auto=\Forest{memoize},
@@ -3492,30 +3586,53 @@
 % The Beamer code is explained in \MS\ref{sec:per-overlay}.
 % 
 %<*latex>
-\AddToHook{begindocument/before}{\@ifclassloaded{beamer}{%
-  % \begin{listingregion}{per-overlay.tex}
-  \mmzset{per overlay/.style={
-    /mmz/context={%
-      overlay=\csname beamer at overlaynumber\endcsname,
-      pauses=\ifmemoizing
-               \mmzBeamerPauses
-             \else
-               \expandafter\the\csname c at beamerpauses\endcsname
-             \fi
+\AddToHook{begindocument/before}{%
+  \@ifclassloaded{beamer}{%
+    \mmz at makeatletter
+    \input{memoize-beamer.code.tex}%
+    \mmz at restoreatcatcode
+  }{}%
+  \@ifpackageloaded{beamerarticle}{%
+    \mmz at makeatletter
+    \input{memoize-beamer.code.tex}%
+    \mmz at restoreatcatcode
+  }{}%
+}
+%</latex>
+%</mmz>
+%<*beamer>
+\mmzset{
+  per overlay/.code={},
+  beamer mode to prefix/.style={
+    prefix=\mmz at prefix@dir\mmz at prefix@name\beamer at currentmode_mode.
+  },
+}%
+\@ifclassloaded{beamer}{%
+  % \begin{listingregion}{per-overlay}
+  \mmzset{
+    per overlay/.style={
+      /mmz/context={%
+        overlay=\csname beamer at overlaynumber\endcsname,
+        pauses=\ifmemoizing
+                 \mmzBeamerPauses
+               \else
+                 \expandafter\the\csname c at beamerpauses\endcsname
+               \fi
+      },
+      /mmz/at begin memoization={%
+        \xdef\mmzBeamerPauses{\the\c at beamerpauses}%
+        \xtoksapp\mmzCMemo{%
+          \noexpand\mmzSetBeamerOverlays{\mmzBeamerPauses}{\beamer at overlaynumber}}%
+        \gtoksapp\mmzCCMemo{%
+          \only<all:\mmzBeamerOverlays>{}}%
+      },
+      /mmz/at end memoization={%
+        \xtoksapp\mmzCCMemo{%
+          \noexpand\setcounter{beamerpauses}{\the\c at beamerpauses}}%
+      },
+      /mmz/per overlay/.code={},
     },
-    /mmz/at begin memoization={%
-      \xdef\mmzBeamerPauses{\the\c at beamerpauses}%
-      \xtoksapp\mmzCMemo{%
-        \noexpand\mmzSetBeamerOverlays{\mmzBeamerPauses}{\beamer at overlaynumber}}%
-      \gtoksapp\mmzCCMemo{%
-        \only<\mmzBeamerOverlays>{}}%
-    },
-    /mmz/at end memoization={%
-      \xtoksapp\mmzCCMemo{%
-        \noexpand\setcounter{beamerpauses}{\the\c at beamerpauses}}%
-    },
-    /mmz/per overlay/.code={},
-  }}
+  }
   \def\mmzSetBeamerOverlays#1#2{%
     \ifnum\c at beamerpauses=#1\relax
       \gdef\mmzBeamerOverlays{#2}%
@@ -3529,8 +3646,9 @@
     \fi
   }%
   % \end{listingregion}
-}{}}
-%</latex>
+}%
+%</beamer>
+%<*mmz>
 %
 % \subsection{Biblatex}
 % \label{sec:biblatex}
@@ -3540,7 +3658,9 @@
 \mmzset{
   biblatex/.code={%
     \mmz at if@package at loaded{biblatex}{}{%
+      \mmz at makeatletter
       \input memoize-biblatex.code.tex
+      \mmz at restoreatcatcode
       \mmzset{#1}%
     }%
   },
@@ -3548,10 +3668,8 @@
 %</latex>
 %</mmz>
 %<*biblatex>
-\edef\memoizeresetatcatcode{\catcode`\noexpand\@\the\catcode`\@\relax}%
-\catcode`\@=11
 \mmzset{%
-  % Advise macro |\entry| occuring in |.bbl| files to collect the entry,
+  % Advise macro |\entry| occurring in |.bbl| files to collect the entry,
   % verbatim. |args|: |m| = citation key, |&&{...}u| = the entry, verbatim,
   % braced --- so |\blx at bbl@entry| will receive two mandatory arguments.
   auto=\blx at bbl@entry{
@@ -3677,6 +3795,7 @@
     \expandafter{\mmz at biblatex@keys}%
 }
 \def\mmz at biblatex@do at context@one#1{%
+  \mmz at Cos
   \mmz at mtoc@csname{mmz at bbl@#1}%
   \ifcsdef{mmz at bbl@#1}{}{\mmzAbort}%
 }
@@ -3808,7 +3927,6 @@
   auto=\citelist{cite, args=l*mlm},
   auto=\citefield{cite, args=l*mlm},
 }
-\memoizeresetatcatcode
 %</biblatex>
 %<*mmz>
 %
@@ -3968,4 +4086,4 @@
 % TeX-engine: luatex
 % TeX-master: "doc/memoize-code.tex"
 % TeX-auto-save: nil
-% End:
\ No newline at end of file
+% End:

Modified: trunk/Master/texmf-dist/source/generic/memoize/memoize.ins
===================================================================
--- trunk/Master/texmf-dist/source/generic/memoize/memoize.ins	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/source/generic/memoize/memoize.ins	2024-11-24 20:54:26 UTC (rev 72961)
@@ -37,5 +37,6 @@
   \file{memoizable.code.tex}{\from{memoize.dtx}{mmzable,generic}}%
   \file{memoize-extract-one.tex}{\from{memoize.dtx}{extract-one}}%
   \file{memoize-biblatex.code.tex}{\from{memoize.dtx}{biblatex}}%
+  \file{memoize-beamer.code.tex}{\from{memoize.dtx}{beamer}}%
 }
 \endbatchfile

Modified: trunk/Master/texmf-dist/tex/context/third/memoize/t-memoizable.tex
===================================================================
--- trunk/Master/texmf-dist/tex/context/third/memoize/t-memoizable.tex	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/tex/context/third/memoize/t-memoizable.tex	2024-11-24 20:54:26 UTC (rev 72961)
@@ -26,11 +26,11 @@
 %% (<texmf>/doc/generic/memoize/)FILES.
 %D \module[
 %D         file=t-memoizable.tex,
-%D      version=1.3.0,
+%D      version=1.4.0,
 %D        title=Memoizable,
 %D     subtitle=A programmer's stub for Memoize,
 %D       author=Saso Zivanovic,
-%D         date=2024-04-02,
+%D         date=2024-11-24,
 %D    copyright=Saso Zivanovic,
 %D      license=LPPL,
 %D ]

Modified: trunk/Master/texmf-dist/tex/context/third/memoize/t-memoize.tex
===================================================================
--- trunk/Master/texmf-dist/tex/context/third/memoize/t-memoize.tex	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/tex/context/third/memoize/t-memoize.tex	2024-11-24 20:54:26 UTC (rev 72961)
@@ -26,11 +26,11 @@
 %% (<texmf>/doc/generic/memoize/)FILES.
 %D \module[
 %D         file=t-memoize.tex,
-%D      version=1.3.0,
+%D      version=1.4.0,
 %D        title=Memoize,
 %D     subtitle=Fast and flexible externalization,
 %D       author=Saso Zivanovic,
-%D         date=2024-04-02,
+%D         date=2024-11-24,
 %D    copyright=Saso Zivanovic,
 %D      license=LPPL,
 %D ]
@@ -375,7 +375,10 @@
   \ifmemoizing
   \else
     \ifmemoize
-      \xdef\mmz at code@mdfivesum{\pdf at mdfivesum{\the\mmz at mdfive@source}}%
+      \xdef\mmz at code@mdfivesum{\pdf at mdfivesum{%
+          \normalexpanded{\the\mmzSalt}%
+          \the\mmz at mdfive@source
+        }}%
       \mmz at trace@code at mdfive
       \ifnum\mmz at mode=\mmz at mode@recompile\relax
         \ifnum\pdf at draftmode=0
@@ -653,16 +656,34 @@
     {}%
   },
   clear context/.value forbidden,
-  meaning to context/.code={\forcsvlist\mmz at mtoc{#1}},
-  csname meaning to context/.code={\mmz at mtoc@csname{#1}},
-  key meaning to context/.code={%
+  meaning to context/.code={\mmz at Cos\forcsvlist\mmz at mtoc{#1}},
+  csname meaning to context/.code={\mmz at Cos\mmz at mtoc@csname{#1}},
+  key meaning to context/.code={\mmz at Cos
     \forcsvlist\mmz at mtoc\mmz at mtoc@keycmd{#1}},
-  key value to context/.code={\forcsvlist\mmz at mtoc@key{#1}},
-  /handlers/.meaning to context/.code={\normalexpanded{%
+  key value to context/.code={\mmz at Cos\forcsvlist\mmz at mtoc@key{#1}},
+  /handlers/.meaning to context/.code={\mmz at Cos\normalexpanded{%
       \noexpand\mmz at mtoc@csname{pgfk@\pgfkeyscurrentpath/. at cmd}}},
-  /handlers/.value to context/.code={%
+  /handlers/.value to context/.code={\mmz at Cos
     \normalexpanded{\noexpand\mmz at mtoc@csname{pgfk@\pgfkeyscurrentpath}}},
 }
+\newtoks\mmzSalt
+\mmzset{
+  salt/.code=\expandafter\toksapp\expandafter\mmzSalt{#1,},
+  clear salt/.value forbidden,
+  clear salt/.code=\mmzSalt{},
+  meaning to salt/.code={\mmz at coS\forcsvlist\mmz at mtoc{#1}},
+  csname meaning to salt/.code={\mmz at coS\mmz at mtoc@csname{#1}},
+  key meaning to salt/.code={\mmz at coS
+    \forcsvlist\mmz at mtoc\mmz at mtoc@keycmd{#1}},
+  key value to salt/.code={\mmz at coS
+    \forcsvlist\mmz at mtoc@key{#1}},
+  /handlers/.meaning to salt/.code={\mmz at coS\normalexpanded{%
+      \noexpand\mmz at mtoc@csname{pgfk@\pgfkeyscurrentpath/. at cmd}}},
+  /handlers/.value to salt/.code={\mmz at coS
+    \normalexpanded{\noexpand\mmz at mtoc@csname{pgfk@\pgfkeyscurrentpath}}},
+}
+\def\mmz at Cos{\def\mmz at context@or at salt{context}}
+\def\mmz at coS{\def\mmz at context@or at salt{salt}}
 \def\mmz at mtoc#1{%
   \collargs at cs@cases{#1}%
     {\mmz at mtoc@cmd{#1}}%
@@ -683,14 +704,17 @@
   \expandafter\mmz at mtoc@csname\expandafter{\string#1}%
 }
 \def\mmz at mtoc@csname#1{%
-  \pgfkeysvalueof{/mmz/context/. at cmd}%
-  \detokenize{#1}={\expandafter\meaning\csname#1\endcsname}%
+  \pgfkeysvalueof{/mmz/\mmz at context@or at salt/. at cmd}%
+  \detokenize{#1}%
+  \ifcsname#1\endcsname
+    ={\expandafter\meaning\csname#1\endcsname}%
+  \fi
   \pgfeov
 }
 \def\mmz at mtoc@key#1{\mmz at mtoc@csname{pgfk@#1}}
 \def\mmz at mtoc@keycmd#1{\mmz at mtoc@csname{pgfk@#1/. at cmd}}
 \def\mmz at mtoc@error at notcsorenv#1{%
-  \PackageError{memoize}{'\detokenize{#1}' passed to key 'meaning to context'
+  \PackageError{memoize}{'\detokenize{#1}' passed to key 'meaning to \mmz at context@or at salt'
     is neither a command nor an environment}{}%
 }
 \def\mmz at cmemo@path{\mmz at prefix\mmz at code@mdfivesum.memo}
@@ -784,6 +808,8 @@
     \fi
     \mmz at trace@resource{#1}%
   \fi
+  \csxdef{mmz at resource@\the\mmz at seq}{\mmz at prefix@dir#1}%
+  \global\advance\mmz at seq1
 }
 \def\mmz at process@ccmemo{%
   \mmz at trace@process at ccmemo
@@ -813,6 +839,7 @@
       }%
     \fi
   }%
+  \global\mmz at seq=0
   \IfFileExists{\mmz at ccmemo@path}{%
     \ifmmz at direct@ccmemo at input
       \input{\mmz at ccmemo@path}%
@@ -930,6 +957,7 @@
       })
     }%
   }%
+  \mmz at shipout@unrotate
   \hoffset\dimexpr\mmz at padding@left - \pdfhorigin\relax
   \voffset\dimexpr\mmz at padding@top - \pdfvorigin\relax
   \pdf at primitive\shipout\box\mmz at box
@@ -967,6 +995,13 @@
 \mmzset{begindocument/.append code={%
     \edef\mmz at inverse@mag{\expandafter\mmz at Pgf@geT\the\dimexpr 1000pt/\mag}%
   }}
+\ifdef\XeTeXversion{%
+  \def\mmz at shipout@unrotate{}%
+}{%
+  \def\mmz at shipout@unrotate{%
+    \pdfpageattr{/Rotate 0}%
+  }%
+}
 \let\mmzRegularPages\realpageno
 \newcount\mmzExternPages
 \mmzset{
@@ -978,14 +1013,18 @@
   },
 }
 \newcount\mmzExtraPages
-\def\mmz at include@extern#1#2#3#4#5#6#7#8#9{%
-  \mmz at seq=#1\relax
+\def\mmz at include@extern#1{%
+  \expandafter\expandafter\expandafter\mmz at include@extern at i
+  \expandafter\expandafter\expandafter{%
+    \csname mmz at resource@#1\endcsname}%
+}
+\def\mmz at include@extern at i#1#2#3#4#5#6#7#8#9{%
   \setbox\mmz at box=#2{%
     \setbox0=\hbox{%
       \lower\dimexpr #5+#7\relax\hbox{%
         \hskip -#6\relax
         \setbox0=\hbox{%
-          \mmz at insertpdfpage{\mmz at extern@path}{1}%
+          \mmz at insertpdfpage{#1}{1}%
         }%
         \unhbox0
       }%
@@ -1408,6 +1447,20 @@
   \pgfeov
   \AdviceOriginal
 }
+\def\mmz at unknown{}
+\mmzset{
+  .unknown/.code={%
+    \eappto\mmz at unknown{,\pgfkeyscurrentkey={#1}}%
+  },
+  begindocument/end/.append code={%
+    \pgfkeyslet{/mmz/.unknown/. at cmd}\undefined
+    \expandafter\pgfkeysalso\expandafter{\mmz at unknown}%
+  },
+}
+\def\mmz at makeatletter{%
+  \edef\mmz at restoreatcatcode{\catcode`\noexpand\@\the\catcode`\@\relax}%
+  \catcode`\@=11
+}
 \def\mmz at if@package at loaded#1#2#3{%
   \mmzset{%
     begindocument/before/.append code={%
@@ -1431,14 +1484,12 @@
     }%
     \ifx\mmz at temp=0
     \else
-      \xtoksapp\mmzCCMemo{%
-        \normalunexpanded{%
-          \global\expandafter\advance\csname pgf at picture@serial at count\endcsname
-        }%
-        \mmz at temp
-      }%
+      \xtoksapp\mmzCCMemo{\noexpand\mmzStepPgfPictureId{\mmz at temp}}%
     \fi
   }%
+  \def\mmzStepPgfPictureId##1{%
+    \global\advance\pgf at picture@serial at count##1\relax
+  }%
   \mmzset{%
     at begin memoization=\mmzPgfAtBeginMemoization,
     at end memoization=\mmzPgfAtEndMemoization,

Modified: trunk/Master/texmf-dist/tex/context/third/memoize/t-nomemoize.tex
===================================================================
--- trunk/Master/texmf-dist/tex/context/third/memoize/t-nomemoize.tex	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/tex/context/third/memoize/t-nomemoize.tex	2024-11-24 20:54:26 UTC (rev 72961)
@@ -26,11 +26,11 @@
 %% (<texmf>/doc/generic/memoize/)FILES.
 %D \module[
 %D         file=t-nomemoize.tex,
-%D      version=1.3.0,
+%D      version=1.4.0,
 %D        title=Memoize,
 %D     subtitle=A no-op stub for Memoize,
 %D       author=Saso Zivanovic,
-%D         date=2024-04-02,
+%D         date=2024-11-24,
 %D    copyright=Saso Zivanovic,
 %D      license=LPPL,
 %D ]

Modified: trunk/Master/texmf-dist/tex/latex/memoize/memoizable.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/memoize/memoizable.sty	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/tex/latex/memoize/memoizable.sty	2024-11-24 20:54:26 UTC (rev 72961)
@@ -24,7 +24,7 @@
 %%
 %% The files belonging to this work and covered by LPPL are listed in
 %% (<texmf>/doc/generic/memoize/)FILES.
-\ProvidesPackage{memoizable}[2024/04/02 v1.3.0 A programmer's stub for Memoize]
+\ProvidesPackage{memoizable}[2024/11/24 v1.4.0 A programmer's stub for Memoize]
 \RequirePackage{pgfkeys}
 \input memoizable.code.tex
 \endinput

Added: trunk/Master/texmf-dist/tex/latex/memoize/memoize-beamer.code.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/memoize/memoize-beamer.code.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/memoize/memoize-beamer.code.tex	2024-11-24 20:54:26 UTC (rev 72961)
@@ -0,0 +1,73 @@
+%%
+%% This is file `memoize-beamer.code.tex',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% memoize.dtx  (with options: `beamer')
+%% 
+%% This file is a part of Memoize, a TeX package for externalization of
+%% graphics and memoization of compilation results in general, available at
+%% https://ctan.org/pkg/memoize and https://github.com/sasozivanovic/memoize.
+%%
+%% Copyright (c) 2020- Saso Zivanovic <saso.zivanovic at guest.arnes.si>
+%%                     (Sa\v{s}o \v{Z}ivanovi\'{c})
+%%
+%% This work may be distributed and/or modified under the conditions of the
+%% LaTeX Project Public License, either version 1.3c of this license or (at
+%% your option) any later version.  The latest version of this license is in
+%% https://www.latex-project.org/lppl.txt and version 1.3c or later is part of
+%% all distributions of LaTeX version 2008 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%% The Current Maintainer of this work is Saso Zivanovic.
+%%
+%% The files belonging to this work and covered by LPPL are listed in
+%% (<texmf>/doc/generic/memoize/)FILES.
+\mmzset{
+  per overlay/.code={},
+  beamer mode to prefix/.style={
+    prefix=\mmz at prefix@dir\mmz at prefix@name\beamer at currentmode_mode.
+  },
+}%
+\@ifclassloaded{beamer}{%
+  \mmzset{
+    per overlay/.style={
+      /mmz/context={%
+        overlay=\csname beamer at overlaynumber\endcsname,
+        pauses=\ifmemoizing
+                 \mmzBeamerPauses
+               \else
+                 \expandafter\the\csname c at beamerpauses\endcsname
+               \fi
+      },
+      /mmz/at begin memoization={%
+        \xdef\mmzBeamerPauses{\the\c at beamerpauses}%
+        \xtoksapp\mmzCMemo{%
+          \noexpand\mmzSetBeamerOverlays{\mmzBeamerPauses}{\beamer at overlaynumber}}%
+        \gtoksapp\mmzCCMemo{%
+          \only<all:\mmzBeamerOverlays>{}}%
+      },
+      /mmz/at end memoization={%
+        \xtoksapp\mmzCCMemo{%
+          \noexpand\setcounter{beamerpauses}{\the\c at beamerpauses}}%
+      },
+      /mmz/per overlay/.code={},
+    },
+  }
+  \def\mmzSetBeamerOverlays#1#2{%
+    \ifnum\c at beamerpauses=#1\relax
+      \gdef\mmzBeamerOverlays{#2}%
+      \ifnum\beamer at overlaynumber<#2\relax \mmz at temptrue \else \mmz at tempfalse \fi
+    \else
+      \mmz at temptrue
+    \fi
+    \ifmmz at temp
+      \appto\mmzAtBeginMemoization{%
+        \gtoksapp\mmzCMemo{\mmzSetBeamerOverlays{#1}{#2}}}%
+    \fi
+  }%
+}%
+\endinput
+%%
+%% End of file `memoize-beamer.code.tex'.


Property changes on: trunk/Master/texmf-dist/tex/latex/memoize/memoize-beamer.code.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/tex/latex/memoize/memoize-biblatex.code.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/memoize/memoize-biblatex.code.tex	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/tex/latex/memoize/memoize-biblatex.code.tex	2024-11-24 20:54:26 UTC (rev 72961)
@@ -24,8 +24,6 @@
 %%
 %% The files belonging to this work and covered by LPPL are listed in
 %% (<texmf>/doc/generic/memoize/)FILES.
-\edef\memoizeresetatcatcode{\catcode`\noexpand\@\the\catcode`\@\relax}%
-\catcode`\@=11
 \mmzset{%
   auto=\blx at bbl@entry{
     inner handler=\mmz at biblatex@entry,
@@ -114,6 +112,7 @@
     \expandafter{\mmz at biblatex@keys}%
 }
 \def\mmz at biblatex@do at context@one#1{%
+  \mmz at Cos
   \mmz at mtoc@csname{mmz at bbl@#1}%
   \ifcsdef{mmz at bbl@#1}{}{\mmzAbort}%
 }
@@ -232,7 +231,6 @@
   auto=\citelist{cite, args=l*mlm},
   auto=\citefield{cite, args=l*mlm},
 }
-\memoizeresetatcatcode
 \endinput
 %%
 %% End of file `memoize-biblatex.code.tex'.

Modified: trunk/Master/texmf-dist/tex/latex/memoize/memoize.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/memoize/memoize.sty	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/tex/latex/memoize/memoize.sty	2024-11-24 20:54:26 UTC (rev 72961)
@@ -24,7 +24,7 @@
 %%
 %% The files belonging to this work and covered by LPPL are listed in
 %% (<texmf>/doc/generic/memoize/)FILES.
-\ProvidesPackage{memoize}[2024/04/02 v1.3.0 Fast and flexible externalization]
+\ProvidesPackage{memoize}[2024/11/24 v1.4.0 Fast and flexible externalization]
 \RequirePackage{etoolbox}
 \ifdefined\luatexversion
   \directlua{memoize = {}}
@@ -321,7 +321,10 @@
   \ifmemoizing
   \else
     \ifmemoize
-      \xdef\mmz at code@mdfivesum{\pdf at mdfivesum{\the\mmz at mdfive@source}}%
+      \xdef\mmz at code@mdfivesum{\pdf at mdfivesum{%
+          \expanded{\the\mmzSalt}%
+          \the\mmz at mdfive@source
+        }}%
       \mmz at trace@code at mdfive
       \ifnum\mmz at mode=\mmz at mode@recompile\relax
         \ifnum\pdf at draftmode=0
@@ -622,16 +625,34 @@
     {}%
   },
   clear context/.value forbidden,
-  meaning to context/.code={\forcsvlist\mmz at mtoc{#1}},
-  csname meaning to context/.code={\mmz at mtoc@csname{#1}},
-  key meaning to context/.code={%
+  meaning to context/.code={\mmz at Cos\forcsvlist\mmz at mtoc{#1}},
+  csname meaning to context/.code={\mmz at Cos\mmz at mtoc@csname{#1}},
+  key meaning to context/.code={\mmz at Cos
     \forcsvlist\mmz at mtoc\mmz at mtoc@keycmd{#1}},
-  key value to context/.code={\forcsvlist\mmz at mtoc@key{#1}},
-  /handlers/.meaning to context/.code={\expanded{%
+  key value to context/.code={\mmz at Cos\forcsvlist\mmz at mtoc@key{#1}},
+  /handlers/.meaning to context/.code={\mmz at Cos\expanded{%
       \noexpand\mmz at mtoc@csname{pgfk@\pgfkeyscurrentpath/. at cmd}}},
-  /handlers/.value to context/.code={%
+  /handlers/.value to context/.code={\mmz at Cos
     \expanded{\noexpand\mmz at mtoc@csname{pgfk@\pgfkeyscurrentpath}}},
 }
+\newtoks\mmzSalt
+\mmzset{
+  salt/.code=\expandafter\toksapp\expandafter\mmzSalt{#1,},
+  clear salt/.value forbidden,
+  clear salt/.code=\mmzSalt{},
+  meaning to salt/.code={\mmz at coS\forcsvlist\mmz at mtoc{#1}},
+  csname meaning to salt/.code={\mmz at coS\mmz at mtoc@csname{#1}},
+  key meaning to salt/.code={\mmz at coS
+    \forcsvlist\mmz at mtoc\mmz at mtoc@keycmd{#1}},
+  key value to salt/.code={\mmz at coS
+    \forcsvlist\mmz at mtoc@key{#1}},
+  /handlers/.meaning to salt/.code={\mmz at coS\expanded{%
+      \noexpand\mmz at mtoc@csname{pgfk@\pgfkeyscurrentpath/. at cmd}}},
+  /handlers/.value to salt/.code={\mmz at coS
+    \expanded{\noexpand\mmz at mtoc@csname{pgfk@\pgfkeyscurrentpath}}},
+}
+\def\mmz at Cos{\def\mmz at context@or at salt{context}}
+\def\mmz at coS{\def\mmz at context@or at salt{salt}}
 \def\mmz at mtoc#1{%
   \collargs at cs@cases{#1}%
     {\mmz at mtoc@cmd{#1}}%
@@ -651,14 +672,17 @@
   \expandafter\mmz at mtoc@csname\expandafter{\string#1}%
 }
 \def\mmz at mtoc@csname#1{%
-  \pgfkeysvalueof{/mmz/context/. at cmd}%
-  \detokenize{#1}={\expandafter\meaning\csname#1\endcsname}%
+  \pgfkeysvalueof{/mmz/\mmz at context@or at salt/. at cmd}%
+  \detokenize{#1}%
+  \ifcsname#1\endcsname
+    ={\expandafter\meaning\csname#1\endcsname}%
+  \fi
   \pgfeov
 }
 \def\mmz at mtoc@key#1{\mmz at mtoc@csname{pgfk@#1}}
 \def\mmz at mtoc@keycmd#1{\mmz at mtoc@csname{pgfk@#1/. at cmd}}
 \def\mmz at mtoc@error at notcsorenv#1{%
-  \PackageError{memoize}{'\detokenize{#1}' passed to key 'meaning to context'
+  \PackageError{memoize}{'\detokenize{#1}' passed to key 'meaning to \mmz at context@or at salt'
     is neither a command nor an environment}{}%
 }
 \def\mmz at cmemo@path{\mmz at prefix\mmz at code@mdfivesum.memo}
@@ -752,6 +776,8 @@
     \fi
     \mmz at trace@resource{#1}%
   \fi
+  \csxdef{mmz at resource@\the\mmz at seq}{\mmz at prefix@dir#1}%
+  \global\advance\mmz at seq1
 }
 \def\mmz at process@ccmemo{%
   \mmz at trace@process at ccmemo
@@ -781,6 +807,7 @@
       }%
     \fi
   }%
+  \global\mmz at seq=0
   \IfFileExists{\mmz at ccmemo@path}{%
     \ifmmz at direct@ccmemo at input
       \input{\mmz at ccmemo@path}%
@@ -884,6 +911,7 @@
     (\mmz at padding@left) + \wd\mmz at box + (\mmz at padding@right)\relax
   \pdfpageheight\dimexpr
     (\mmz at padding@top) + \ht\mmz at box + \dp\mmz at box+ (\mmz at padding@bottom)\relax
+  \mmz at shipout@unrotate
   \hoffset\dimexpr\mmz at padding@left - \pdfhorigin\relax
   \voffset\dimexpr\mmz at padding@top - \pdfvorigin\relax
   \let\protect\noexpand
@@ -920,6 +948,13 @@
 \mmzset{begindocument/.append code={%
     \edef\mmz at inverse@mag{\expandafter\mmz at Pgf@geT\the\dimexpr 1000pt/\mag}%
   }}
+\ifdef\XeTeXversion{%
+  \def\mmz at shipout@unrotate{}%
+}{%
+  \def\mmz at shipout@unrotate{%
+    \IfPDFManagementActiveTF{}{\pdfpageattr{/Rotate 0}}%
+  }%
+}
 \let\mmzRegularPages\ReadonlyShipoutCounter
 \newcount\mmzExternPages
 \mmzset{
@@ -931,14 +966,18 @@
   },
 }
 \newcount\mmzExtraPages
-\def\mmz at include@extern#1#2#3#4#5#6#7#8#9{%
-  \mmz at seq=#1\relax
+\def\mmz at include@extern#1{%
+  \expandafter\expandafter\expandafter\mmz at include@extern at i
+  \expandafter\expandafter\expandafter{%
+    \csname mmz at resource@#1\endcsname}%
+}
+\def\mmz at include@extern at i#1#2#3#4#5#6#7#8#9{%
   \setbox\mmz at box=#2{%
     \setbox0=\hbox{%
       \lower\dimexpr #5+#7\relax\hbox{%
         \hskip -#6\relax
         \setbox0=\hbox{%
-          \mmz at insertpdfpage{\mmz at extern@path}{1}%
+          \mmz at insertpdfpage{#1}{1}%
         }%
         \unhbox0
       }%
@@ -1403,7 +1442,8 @@
   \AdviceOriginal#2{#3}%
 }
 \def\mmzForceNoRef#1{%
-  \mmz at mtoc@csname{r@#1}%
+  \mmz at Cos
+  \expandafter\mmz at mtoc@csname\expandafter{\expanded{r@#1}}%
   \ignorespaces
 }
 \def\mmzNoRef#1{%
@@ -1447,10 +1487,24 @@
   \label{#1}%
   \endgroup
 }
+\def\mmz at unknown{}
+\mmzset{
+  .unknown/.code={%
+    \eappto\mmz at unknown{,\pgfkeyscurrentkey={#1}}%
+  },
+  begindocument/end/.append code={%
+    \pgfkeyslet{/mmz/.unknown/. at cmd}\undefined
+    \expandafter\pgfkeysalso\expandafter{\mmz at unknown}%
+  },
+}
 \AddToHook{shipout/before}[memoize]{\global\advance\mmzExtraPages-1\relax}
 \AddToHook{shipout/after}[memoize]{\global\advance\mmzExtraPages1\relax}
 \mmzset{auto=\DiscardShipoutBox{
     outer handler=\global\advance\mmzExtraPages1\relax\AdviceOriginal}}
+\def\mmz at makeatletter{%
+  \edef\mmz at restoreatcatcode{\catcode`\noexpand\@\the\catcode`\@\relax}%
+  \catcode`\@=11
+}
 \def\mmz at if@package at loaded#1#2#3{%
   \mmzset{%
     begindocument/before/.append code={%
@@ -1473,14 +1527,12 @@
     }%
     \ifx\mmz at temp=0
     \else
-      \xtoksapp\mmzCCMemo{%
-        \unexpanded{%
-          \global\expandafter\advance\csname pgf at picture@serial at count\endcsname
-        }%
-        \mmz at temp
-      }%
+      \xtoksapp\mmzCCMemo{\noexpand\mmzStepPgfPictureId{\mmz at temp}}%
     \fi
   }%
+  \def\mmzStepPgfPictureId##1{%
+    \global\advance\pgf at picture@serial at count##1\relax
+  }%
   \mmzset{%
     at begin memoization=\mmzPgfAtBeginMemoization,
     at end memoization=\mmzPgfAtEndMemoization,
@@ -1499,46 +1551,24 @@
     auto=\Forest{memoize},
   }%
 }
-\AddToHook{begindocument/before}{\@ifclassloaded{beamer}{%
-  \mmzset{per overlay/.style={
-    /mmz/context={%
-      overlay=\csname beamer at overlaynumber\endcsname,
-      pauses=\ifmemoizing
-               \mmzBeamerPauses
-             \else
-               \expandafter\the\csname c at beamerpauses\endcsname
-             \fi
-    },
-    /mmz/at begin memoization={%
-      \xdef\mmzBeamerPauses{\the\c at beamerpauses}%
-      \xtoksapp\mmzCMemo{%
-        \noexpand\mmzSetBeamerOverlays{\mmzBeamerPauses}{\beamer at overlaynumber}}%
-      \gtoksapp\mmzCCMemo{%
-        \only<\mmzBeamerOverlays>{}}%
-    },
-    /mmz/at end memoization={%
-      \xtoksapp\mmzCCMemo{%
-        \noexpand\setcounter{beamerpauses}{\the\c at beamerpauses}}%
-    },
-    /mmz/per overlay/.code={},
-  }}
-  \def\mmzSetBeamerOverlays#1#2{%
-    \ifnum\c at beamerpauses=#1\relax
-      \gdef\mmzBeamerOverlays{#2}%
-      \ifnum\beamer at overlaynumber<#2\relax \mmz at temptrue \else \mmz at tempfalse \fi
-    \else
-      \mmz at temptrue
-    \fi
-    \ifmmz at temp
-      \appto\mmzAtBeginMemoization{%
-        \gtoksapp\mmzCMemo{\mmzSetBeamerOverlays{#1}{#2}}}%
-    \fi
-  }%
-}{}}
+\AddToHook{begindocument/before}{%
+  \@ifclassloaded{beamer}{%
+    \mmz at makeatletter
+    \input{memoize-beamer.code.tex}%
+    \mmz at restoreatcatcode
+  }{}%
+  \@ifpackageloaded{beamerarticle}{%
+    \mmz at makeatletter
+    \input{memoize-beamer.code.tex}%
+    \mmz at restoreatcatcode
+  }{}%
+}
 \mmzset{
   biblatex/.code={%
     \mmz at if@package at loaded{biblatex}{}{%
+      \mmz at makeatletter
       \input memoize-biblatex.code.tex
+      \mmz at restoreatcatcode
       \mmzset{#1}%
     }%
   },

Modified: trunk/Master/texmf-dist/tex/latex/memoize/nomemoize.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/memoize/nomemoize.sty	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/tex/latex/memoize/nomemoize.sty	2024-11-24 20:54:26 UTC (rev 72961)
@@ -24,7 +24,7 @@
 %%
 %% The files belonging to this work and covered by LPPL are listed in
 %% (<texmf>/doc/generic/memoize/)FILES.
-\ProvidesPackage{nomemoize}[2024/04/02 v1.3.0 A no-op stub for Memoize]
+\ProvidesPackage{nomemoize}[2024/11/24 v1.4.0 A no-op stub for Memoize]
 \RequirePackage{pgfkeys}
 \def\ifmmz at loadstatus#1{%
   \ifnum#1=0\csname mmz at loadstatus\endcsname\relax

Modified: trunk/Master/texmf-dist/tex/plain/memoize/memoizable.tex
===================================================================
--- trunk/Master/texmf-dist/tex/plain/memoize/memoizable.tex	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/tex/plain/memoize/memoizable.tex	2024-11-24 20:54:26 UTC (rev 72961)
@@ -24,7 +24,7 @@
 %%
 %% The files belonging to this work and covered by LPPL are listed in
 %% (<texmf>/doc/generic/memoize/)FILES.
-% Package memoizable 2024/04/02 v1.3.0
+% Package memoizable 2024/11/24 v1.4.0
 \input miniltx
 \input pgfkeys
 \input memoizable.code.tex

Modified: trunk/Master/texmf-dist/tex/plain/memoize/memoize.tex
===================================================================
--- trunk/Master/texmf-dist/tex/plain/memoize/memoize.tex	2024-11-24 20:54:02 UTC (rev 72960)
+++ trunk/Master/texmf-dist/tex/plain/memoize/memoize.tex	2024-11-24 20:54:26 UTC (rev 72961)
@@ -24,7 +24,7 @@
 %%
 %% The files belonging to this work and covered by LPPL are listed in
 %% (<texmf>/doc/generic/memoize/)FILES.
-% Package memoize 2024/04/02 v1.3.0
+% Package memoize 2024/11/24 v1.4.0
 \input miniltx
 \def\PackageWarning#1#2{{%
     \newlinechar`\^^J\def\MessageBreak{^^J\space\space#1: }%
@@ -350,7 +350,10 @@
   \ifmemoizing
   \else
     \ifmemoize
-      \xdef\mmz at code@mdfivesum{\pdf at mdfivesum{\the\mmz at mdfive@source}}%
+      \xdef\mmz at code@mdfivesum{\pdf at mdfivesum{%
+          \expanded{\the\mmzSalt}%
+          \the\mmz at mdfive@source
+        }}%
       \mmz at trace@code at mdfive
       \ifnum\mmz at mode=\mmz at mode@recompile\relax
         \ifnum\pdf at draftmode=0
@@ -651,16 +654,34 @@
     {}%
   },
   clear context/.value forbidden,
-  meaning to context/.code={\forcsvlist\mmz at mtoc{#1}},
-  csname meaning to context/.code={\mmz at mtoc@csname{#1}},
-  key meaning to context/.code={%
+  meaning to context/.code={\mmz at Cos\forcsvlist\mmz at mtoc{#1}},
+  csname meaning to context/.code={\mmz at Cos\mmz at mtoc@csname{#1}},
+  key meaning to context/.code={\mmz at Cos
     \forcsvlist\mmz at mtoc\mmz at mtoc@keycmd{#1}},
-  key value to context/.code={\forcsvlist\mmz at mtoc@key{#1}},
-  /handlers/.meaning to context/.code={\expanded{%
+  key value to context/.code={\mmz at Cos\forcsvlist\mmz at mtoc@key{#1}},
+  /handlers/.meaning to context/.code={\mmz at Cos\expanded{%
       \noexpand\mmz at mtoc@csname{pgfk@\pgfkeyscurrentpath/. at cmd}}},
-  /handlers/.value to context/.code={%
+  /handlers/.value to context/.code={\mmz at Cos
     \expanded{\noexpand\mmz at mtoc@csname{pgfk@\pgfkeyscurrentpath}}},
 }
+\newtoks\mmzSalt
+\mmzset{
+  salt/.code=\expandafter\toksapp\expandafter\mmzSalt{#1,},
+  clear salt/.value forbidden,
+  clear salt/.code=\mmzSalt{},
+  meaning to salt/.code={\mmz at coS\forcsvlist\mmz at mtoc{#1}},
+  csname meaning to salt/.code={\mmz at coS\mmz at mtoc@csname{#1}},
+  key meaning to salt/.code={\mmz at coS
+    \forcsvlist\mmz at mtoc\mmz at mtoc@keycmd{#1}},
+  key value to salt/.code={\mmz at coS
+    \forcsvlist\mmz at mtoc@key{#1}},
+  /handlers/.meaning to salt/.code={\mmz at coS\expanded{%
+      \noexpand\mmz at mtoc@csname{pgfk@\pgfkeyscurrentpath/. at cmd}}},
+  /handlers/.value to salt/.code={\mmz at coS
+    \expanded{\noexpand\mmz at mtoc@csname{pgfk@\pgfkeyscurrentpath}}},
+}
+\def\mmz at Cos{\def\mmz at context@or at salt{context}}
+\def\mmz at coS{\def\mmz at context@or at salt{salt}}
 \def\mmz at mtoc#1{%
   \collargs at cs@cases{#1}%
     {\mmz at mtoc@cmd{#1}}%
@@ -680,14 +701,17 @@
   \expandafter\mmz at mtoc@csname\expandafter{\string#1}%
 }
 \def\mmz at mtoc@csname#1{%
-  \pgfkeysvalueof{/mmz/context/. at cmd}%
-  \detokenize{#1}={\expandafter\meaning\csname#1\endcsname}%
+  \pgfkeysvalueof{/mmz/\mmz at context@or at salt/. at cmd}%
+  \detokenize{#1}%
+  \ifcsname#1\endcsname
+    ={\expandafter\meaning\csname#1\endcsname}%
+  \fi
   \pgfeov
 }
 \def\mmz at mtoc@key#1{\mmz at mtoc@csname{pgfk@#1}}
 \def\mmz at mtoc@keycmd#1{\mmz at mtoc@csname{pgfk@#1/. at cmd}}
 \def\mmz at mtoc@error at notcsorenv#1{%
-  \PackageError{memoize}{'\detokenize{#1}' passed to key 'meaning to context'
+  \PackageError{memoize}{'\detokenize{#1}' passed to key 'meaning to \mmz at context@or at salt'
     is neither a command nor an environment}{}%
 }
 \def\mmz at cmemo@path{\mmz at prefix\mmz at code@mdfivesum.memo}
@@ -781,6 +805,8 @@
     \fi
     \mmz at trace@resource{#1}%
   \fi
+  \csxdef{mmz at resource@\the\mmz at seq}{\mmz at prefix@dir#1}%
+  \global\advance\mmz at seq1
 }
 \def\mmz at process@ccmemo{%
   \mmz at trace@process at ccmemo
@@ -810,6 +836,7 @@
       }%
     \fi
   }%
+  \global\mmz at seq=0
   \IfFileExists{\mmz at ccmemo@path}{%
     \ifmmz at direct@ccmemo at input
       \input{\mmz at ccmemo@path}%
@@ -913,6 +940,7 @@
     (\mmz at padding@left) + \wd\mmz at box + (\mmz at padding@right)\relax
   \pdfpageheight\dimexpr
     (\mmz at padding@top) + \ht\mmz at box + \dp\mmz at box+ (\mmz at padding@bottom)\relax
+  \mmz at shipout@unrotate
   \hoffset\dimexpr\mmz at padding@left - \pdfhorigin\relax
   \voffset\dimexpr\mmz at padding@top - \pdfvorigin\relax
   \pdf at primitive\shipout\box\mmz at box
@@ -948,6 +976,13 @@
 \mmzset{begindocument/.append code={%
     \edef\mmz at inverse@mag{\expandafter\mmz at Pgf@geT\the\dimexpr 1000pt/\mag}%
   }}
+\ifdef\XeTeXversion{%
+  \def\mmz at shipout@unrotate{}%
+}{%
+  \def\mmz at shipout@unrotate{%
+    \pdfpageattr{/Rotate 0}%
+  }%
+}
 \newcount\mmzRegularPages
 \newcount\mmzExternPages
 \mmzset{
@@ -959,14 +994,18 @@
   },
 }
 \newcount\mmzExtraPages
-\def\mmz at include@extern#1#2#3#4#5#6#7#8#9{%
-  \mmz at seq=#1\relax
+\def\mmz at include@extern#1{%
+  \expandafter\expandafter\expandafter\mmz at include@extern at i
+  \expandafter\expandafter\expandafter{%
+    \csname mmz at resource@#1\endcsname}%
+}
+\def\mmz at include@extern at i#1#2#3#4#5#6#7#8#9{%
   \setbox\mmz at box=#2{%
     \setbox0=\hbox{%
       \lower\dimexpr #5+#7\relax\hbox{%
         \hskip -#6\relax
         \setbox0=\hbox{%
-          \mmz at insertpdfpage{\mmz at extern@path}{1}%
+          \mmz at insertpdfpage{#1}{1}%
         }%
         \unhbox0
       }%
@@ -1402,6 +1441,20 @@
   \pgfeov
   \AdviceOriginal
 }
+\def\mmz at unknown{}
+\mmzset{
+  .unknown/.code={%
+    \eappto\mmz at unknown{,\pgfkeyscurrentkey={#1}}%
+  },
+  begindocument/end/.append code={%
+    \pgfkeyslet{/mmz/.unknown/. at cmd}\undefined
+    \expandafter\pgfkeysalso\expandafter{\mmz at unknown}%
+  },
+}
+\def\mmz at makeatletter{%
+  \edef\mmz at restoreatcatcode{\catcode`\noexpand\@\the\catcode`\@\relax}%
+  \catcode`\@=11
+}
 \def\mmz at if@package at loaded#1#2#3{%
   \mmzset{%
     begindocument/before/.append code={%
@@ -1425,14 +1478,12 @@
     }%
     \ifx\mmz at temp=0
     \else
-      \xtoksapp\mmzCCMemo{%
-        \unexpanded{%
-          \global\expandafter\advance\csname pgf at picture@serial at count\endcsname
-        }%
-        \mmz at temp
-      }%
+      \xtoksapp\mmzCCMemo{\noexpand\mmzStepPgfPictureId{\mmz at temp}}%
     \fi
   }%
+  \def\mmzStepPgfPictureId##1{%
+    \global\advance\pgf at picture@serial at count##1\relax
+  }%
   \mmzset{%
     at begin memoization=\mmzPgfAtBeginMemoization,
     at end memoization=\mmzPgfAtEndMemoization,



More information about the tex-live-commits mailing list.