latex-packages/tests/wip/cache/test.tex

53 lines
1.3 KiB
TeX

\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}
\section{test}
\ExplSyntaxOn
%\clist_show:N \g__cache_lazy_auxfile_tl
\ExplSyntaxOff
\foo { one }
\baz{ arg }
\parser*+
Some text.
\end{document}