summaryrefslogtreecommitdiff
path: root/macros/generic/memoize/memoize.edtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/generic/memoize/memoize.edtx')
-rw-r--r--macros/generic/memoize/memoize.edtx292
1 files changed, 205 insertions, 87 deletions
diff --git a/macros/generic/memoize/memoize.edtx b/macros/generic/memoize/memoize.edtx
index d974aff72a..96f53611ef 100644
--- a/macros/generic/memoize/memoize.edtx
+++ b/macros/generic/memoize/memoize.edtx
@@ -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,55 +90,55 @@
%
% \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 ]
%<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 ]
%<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 ]
%<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@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@code@mdfivesum{\pdf@mdfivesum{\the\mmz@mdfive@source}}%
+ % |\mmzMemo|) while inputting the cc-memo.
+ \xdef\mmz@code@mdfivesum{\pdf@mdfivesum{%
+ \expanded{\the\mmzSalt}%
+ \the\mmz@mdfive@source
+ }}%
\mmz@trace@code@mdfive
% Recompile mode forces memoization.
\ifnum\mmz@mode=\mmz@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@maybe@quitvmode}%
\setbox\mmz@box\mmz@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@mtoc{#1}},
- csname meaning to context/.code={\mmz@mtoc@csname{#1}},
- key meaning to context/.code={%
+ meaning to context/.code={\mmz@Cos\forcsvlist\mmz@mtoc{#1}},
+ csname meaning to context/.code={\mmz@Cos\mmz@mtoc@csname{#1}},
+ key meaning to context/.code={\mmz@Cos
\forcsvlist\mmz@mtoc\mmz@mtoc@keycmd{#1}},
- key value to context/.code={\forcsvlist\mmz@mtoc@key{#1}},
- /handlers/.meaning to context/.code={\expanded{%
+ key value to context/.code={\mmz@Cos\forcsvlist\mmz@mtoc@key{#1}},
+ /handlers/.meaning to context/.code={\mmz@Cos\expanded{%
\noexpand\mmz@mtoc@csname{pgfk@\pgfkeyscurrentpath/.@cmd}}},
- /handlers/.value to context/.code={%
+ /handlers/.value to context/.code={\mmz@Cos
\expanded{\noexpand\mmz@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@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@coS\forcsvlist\mmz@mtoc{#1}},
+ csname meaning to salt/.code={\mmz@coS\mmz@mtoc@csname{#1}},
+ key meaning to salt/.code={\mmz@coS
+ \forcsvlist\mmz@mtoc\mmz@mtoc@keycmd{#1}},
+ key value to salt/.code={\mmz@coS
+ \forcsvlist\mmz@mtoc@key{#1}},
+ /handlers/.meaning to salt/.code={\mmz@coS\expanded{%
+ \noexpand\mmz@mtoc@csname{pgfk@\pgfkeyscurrentpath/.@cmd}}},
+ /handlers/.value to salt/.code={\mmz@coS
+ \expanded{\noexpand\mmz@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@Cos| (for context) or |\mmz@coS| (for salt).
% \noindentmacrocode
+\def\mmz@Cos{\def\mmz@context@or@salt{context}}
+\def\mmz@coS{\def\mmz@context@or@salt{salt}}
\def\mmz@mtoc#1{%
\collargs@cs@cases{#1}%
{\mmz@mtoc@cmd{#1}}%
@@ -1512,14 +1548,17 @@
\expandafter\mmz@mtoc@csname\expandafter{\string#1}%
}
\def\mmz@mtoc@csname#1{%
- \pgfkeysvalueof{/mmz/context/.@cmd}%
- \detokenize{#1}={\expandafter\meaning\csname#1\endcsname}%
+ \pgfkeysvalueof{/mmz/\mmz@context@or@salt/.@cmd}%
+ \detokenize{#1}%
+ \ifcsname#1\endcsname
+ ={\expandafter\meaning\csname#1\endcsname}%
+ \fi
\pgfeov
}
\def\mmz@mtoc@key#1{\mmz@mtoc@csname{pgfk@#1}}
\def\mmz@mtoc@keycmd#1{\mmz@mtoc@csname{pgfk@#1/.@cmd}}
\def\mmz@mtoc@error@notcsorenv#1{%
- \PackageError{memoize}{'\detokenize{#1}' passed to key 'meaning to context'
+ \PackageError{memoize}{'\detokenize{#1}' passed to key 'meaning to \mmz@context@or@salt'
is neither a command nor an environment}{}%
}
% \end{key}
@@ -1770,6 +1809,14 @@
\fi
\mmz@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@resource@<seq>|, which will be inspected by |\mmzIncludeExtern|.
+ \csxdef{mmz@resource@\the\mmz@seq}{\mmz@prefix@dir#1}%
+ \global\advance\mmz@seq1
}
% \end{macro}
%
@@ -1830,6 +1877,8 @@
}%
\fi
}%
+ % Reset |\mmz@seq| for |\mmzResorce|.
+ \global\mmz@seq=0
% Input the cc-memo if it exists.
\IfFileExists{\mmz@ccmemo@path}{%
\ifmmz@direct@ccmemo@input
@@ -2099,6 +2148,7 @@
}%
}%
%</context>
+ \mmz@shipout@unrotate
%
% We complete the page setup by setting the content offset.
\hoffset\dimexpr\mmz@padding@left - \pdfhorigin\relax
@@ -2198,6 +2248,24 @@
\edef\mmz@inverse@mag{\expandafter\mmz@Pgf@geT\the\dimexpr 1000pt/\mag}%
}}
% \end{macro}
+%
+%
+% \begin{macro}{\mmz@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@shipout@unrotate{}%
+}{%
+ \def\mmz@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
@@ -2237,14 +2305,18 @@
%
% \begin{macro}{\mmz@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@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@extern@basename|).
- \mmz@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@include@extern#1{%
+ \expandafter\expandafter\expandafter\mmz@include@extern@i
+ \expandafter\expandafter\expandafter{%
+ \csname mmz@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@include@extern@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@insertpdfpage{\mmz@extern@path}{1}%
+ \mmz@insertpdfpage{#1}{1}%
}%
\unhbox0
}%
@@ -2792,14 +2864,14 @@
\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"
% \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@auto@rc@if@memoization@possible{%
\ifmemoize
\ifinmemoize
@@ -3095,14 +3167,14 @@
% 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@auto@outer{%
\begingroup
\mmzAutoInit
\AdviceCollector
}
% \end{listingregion}
-% \begin{listingregion}{_auto-memoize-bailout.tex}
+% \begin{listingregion}{_auto-memoize-bailout}
\def\mmz@auto@bailout{%
\mmznext{}%
}
@@ -3153,7 +3225,7 @@
% executing |\Memoize| closes the memoization group and we lose the current
% value of |\ifmmz@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@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@auto@ref\mmzNoRef, run if memoizing},
force ref/.style={outer handler=\mmz@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@auto@ref@i| is the cross-reference key.
-% \begin{listingregion}{_auto-memoize-ref.tex}
+% \begin{listingregion}{_auto-memoize-ref}
\def\mmz@auto@ref#1#2#{\mmz@auto@ref@i#1{#2}}
\def\mmz@auto@ref@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@mtoc@csname{r@#1}%
+ \mmz@Cos
+ \expandafter\mmz@mtoc@csname\expandafter{\expanded{r@#1}}%
\ignorespaces
}
\def\mmzNoRef#1{%
@@ -3391,18 +3462,41 @@
%
% \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@unknown{}
+\mmzset{
+ .unknown/.code={%
+ \eappto\mmz@unknown{,\pgfkeyscurrentkey={#1}}%
+ },
+ begindocument/end/.append code={%
+ \pgfkeyslet{/mmz/.unknown/.@cmd}\undefined
+ \expandafter\pgfkeysalso\expandafter{\mmz@unknown}%
+ },
+}
+%
%<*latex>
\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}}
%</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@makeatletter| and
+% |\mmz@restoreatcatcode|.
+\def\mmz@makeatletter{%
+ \edef\mmz@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@if@package@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@pgfpictureid{%
\the\pgf@picture@serial@count
@@ -3432,15 +3528,13 @@
}%
\ifx\mmz@temp=0
\else
- \xtoksapp\mmzCCMemo{%
- \unexpanded{%
- \global\expandafter\advance\csname pgf@picture@serial@count\endcsname
- }%
- \mmz@temp
- }%
+ \xtoksapp\mmzCCMemo{\noexpand\mmzStepPgfPictureId{\mmz@temp}}%
\fi
}%
- % \begin{listingregion}{_support-pgf.tex}
+ \def\mmzStepPgfPictureId##1{%
+ \global\advance\pgf@picture@serial@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@if@package@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@overlaynumber\endcsname,
- pauses=\ifmemoizing
- \mmzBeamerPauses
- \else
- \expandafter\the\csname c@beamerpauses\endcsname
- \fi
- },
- /mmz/at begin memoization={%
- \xdef\mmzBeamerPauses{\the\c@beamerpauses}%
- \xtoksapp\mmzCMemo{%
- \noexpand\mmzSetBeamerOverlays{\mmzBeamerPauses}{\beamer@overlaynumber}}%
- \gtoksapp\mmzCCMemo{%
- \only<\mmzBeamerOverlays>{}}%
- },
- /mmz/at end memoization={%
- \xtoksapp\mmzCCMemo{%
- \noexpand\setcounter{beamerpauses}{\the\c@beamerpauses}}%
+\AddToHook{begindocument/before}{%
+ \@ifclassloaded{beamer}{%
+ \mmz@makeatletter
+ \input{memoize-beamer.code.tex}%
+ \mmz@restoreatcatcode
+ }{}%
+ \@ifpackageloaded{beamerarticle}{%
+ \mmz@makeatletter
+ \input{memoize-beamer.code.tex}%
+ \mmz@restoreatcatcode
+ }{}%
+}
+%</latex>
+%</mmz>
+%<*beamer>
+\mmzset{
+ per overlay/.code={},
+ beamer mode to prefix/.style={
+ prefix=\mmz@prefix@dir\mmz@prefix@name\beamer@currentmode_mode.
+ },
+}%
+\@ifclassloaded{beamer}{%
+ % \begin{listingregion}{per-overlay}
+ \mmzset{
+ per overlay/.style={
+ /mmz/context={%
+ overlay=\csname beamer@overlaynumber\endcsname,
+ pauses=\ifmemoizing
+ \mmzBeamerPauses
+ \else
+ \expandafter\the\csname c@beamerpauses\endcsname
+ \fi
+ },
+ /mmz/at begin memoization={%
+ \xdef\mmzBeamerPauses{\the\c@beamerpauses}%
+ \xtoksapp\mmzCMemo{%
+ \noexpand\mmzSetBeamerOverlays{\mmzBeamerPauses}{\beamer@overlaynumber}}%
+ \gtoksapp\mmzCCMemo{%
+ \only<all:\mmzBeamerOverlays>{}}%
+ },
+ /mmz/at end memoization={%
+ \xtoksapp\mmzCCMemo{%
+ \noexpand\setcounter{beamerpauses}{\the\c@beamerpauses}}%
+ },
+ /mmz/per overlay/.code={},
},
- /mmz/per overlay/.code={},
- }}
+ }
\def\mmzSetBeamerOverlays#1#2{%
\ifnum\c@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@if@package@loaded{biblatex}{}{%
+ \mmz@makeatletter
\input memoize-biblatex.code.tex
+ \mmz@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@bbl@entry| will receive two mandatory arguments.
auto=\blx@bbl@entry{
@@ -3677,6 +3795,7 @@
\expandafter{\mmz@biblatex@keys}%
}
\def\mmz@biblatex@do@context@one#1{%
+ \mmz@Cos
\mmz@mtoc@csname{mmz@bbl@#1}%
\ifcsdef{mmz@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: