From 47e40def1759e646694d1fac62a4ef7387a20522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Wed, 2 Feb 2022 17:41:02 +0100 Subject: [PATCH] add test file showing usage of cache package --- tests/wip/test.tex | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/wip/test.tex diff --git a/tests/wip/test.tex b/tests/wip/test.tex new file mode 100644 index 0000000..eb85da9 --- /dev/null +++ b/tests/wip/test.tex @@ -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}