2022-02-02 17:41:02 +01:00
|
|
|
\documentclass{article}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%% Setting a higher cache version will cause a re-evaluation of the
|
|
|
|
% \DeclareCachedDocumentCommand macros present in the preamble
|
|
|
|
% Otherwise, the definitions can be altered or even removed without breaking
|
|
|
|
% the document, as long as the aux file is present.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%% \DeclareCachedDocumentCommand is now just a plain wrapper around \DeclareDocumentCommand
|
|
|
|
%% that implements this caching, so it is not useful on itself
|
|
|
|
%%
|
|
|
|
%% If \DeclareCachedDocumentCommand is, however, some macro that does lengthy computations
|
|
|
|
%% and then issues one ore more of underlying \DeclareDocumentCommands
|
|
|
|
%% we can save this computation on the second run, since we do not evaluate
|
|
|
|
%% \DeclareCachedDocumentCommand further (we just copied its definition)
|
|
|
|
%% and load the plain definitions that the invocation produced in the last run
|
|
|
|
%% and that we saved to the aux file for restoration.
|
|
|
|
|
|
|
|
\usepackage[cache version = 0]{mkessler-cache}
|
|
|
|
|
|
|
|
\DeclareCachedDocumentCommand\foo{m}{foo: Called with argument '#1'. hi}
|
|
|
|
\DeclareCachedDocumentCommand\baz{m}{baz: Called with argument '#1'.}
|
|
|
|
|
|
|
|
\DeclareCachedDocumentCommand\parser{!s !t+}
|
|
|
|
{
|
|
|
|
\IfBooleanT {#1} {*}
|
|
|
|
\IfBooleanT {#2} {$\dagger$}
|
|
|
|
}
|
|
|
|
|
|
|
|
\begin{document}
|
|
|
|
|
2022-02-03 12:31:49 +01:00
|
|
|
|
|
|
|
\section{test}
|
|
|
|
|
|
|
|
\ExplSyntaxOn
|
|
|
|
|
|
|
|
%\clist_show:N \g__cache_lazy_auxfile_tl
|
|
|
|
|
|
|
|
\ExplSyntaxOff
|
|
|
|
|
2022-02-02 17:41:02 +01:00
|
|
|
\foo { one }
|
|
|
|
|
|
|
|
\baz{ arg }
|
|
|
|
|
|
|
|
\parser*+
|
|
|
|
|
|
|
|
Some text.
|
|
|
|
|
|
|
|
\end{document}
|