add test file showing usage of cache package
This commit is contained in:
parent
0fd205df16
commit
47e40def17
1 changed files with 43 additions and 0 deletions
43
tests/wip/test.tex
Normal file
43
tests/wip/test.tex
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
\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}
|
||||||
|
|
||||||
|
\foo { one }
|
||||||
|
|
||||||
|
\baz{ arg }
|
||||||
|
|
||||||
|
\parser*+
|
||||||
|
|
||||||
|
Some text.
|
||||||
|
|
||||||
|
\end{document}
|
Loading…
Reference in a new issue