Add proper memoize integration #21

Closed
lukas wants to merge 0 commits from feat-memoize into main
Owner

solves #6

solves #6
lukas self-assigned this 2026-03-30 11:08:14 +00:00
Author
Owner

Analysis of the generated memos when typesetting the Extended Example (plus a simple tikzpicture):

  1. 5 externs generated (4 steps + 1 tikzpicture)
  2. context of the tikzpicture is unaltered
\mmzResource{main.13CA6225EF1CB8B2D15D71140C2A246B-E778DCCCB8AAB0BBD3F6CFEEFD2421F8.pdf}%
\mmzMemo
\quitvmode \mmzIncludeExtern {0}\hbox {21.94595pt}{13.71594pt}{0.0pt}{72.26999pt}{72.26999pt}{72.26999pt}{72.26999pt}\mmzStepPgfPictureId {1}%
\mmzThisContext
padding=(1in,1in,1in,1in),
\mmzEndMemo
  1. Other contexts:
padding=(1in,1in,1in,1in),stepCnt->3,kata version->0.1.0,,kataStepCnt code={\protected macro:#1->\arabic {#1}},pgfk@/tikz/head/.@cmd,pgfk@/tikz/stance/.@cmd,pgfk@/tikz/stance label/.@cmd,pgfk@/tikz/stance label base/.@cmd,pgfk@/tikz/waza/.@cmd,pgfk@/tikz/waza label/.@cmd,pgfk@/tikz/waza label base/.@cmd,pgfk@/tikz/border/.@cmd,pgfk@/tikz/step counter/.@cmd,
padding=(1in,1in,1in,1in),stepCnt->0,kata version->0.1.0,,kataStepCnt code={\protected macro:#1->\arabic {#1}},pgfk@/tikz/head/.@cmd,pgfk@/tikz/stance/.@cmd,pgfk@/tikz/stance label/.@cmd,pgfk@/tikz/stance label base/.@cmd,pgfk@/tikz/waza/.@cmd,pgfk@/tikz/waza label/.@cmd,pgfk@/tikz/waza label base/.@cmd,pgfk@/tikz/dir/.@cmd,pgfk@/tikz/border/.@cmd,pgfk@/tikz/step counter/.@cmd,
padding=(1in,1in,1in,1in),stepCnt->1,kata version->0.1.0,,kataStepCnt code={\protected macro:#1->\arabic {#1}},pgfk@/tikz/head/.@cmd,pgfk@/tikz/stance/.@cmd,pgfk@/tikz/stance label/.@cmd,pgfk@/tikz/stance label base/.@cmd,pgfk@/tikz/waza/.@cmd,pgfk@/tikz/waza label/.@cmd,pgfk@/tikz/waza label base/.@cmd,pgfk@/tikz/dir/.@cmd,pgfk@/tikz/border/.@cmd,pgfk@/tikz/step counter/.@cmd,
padding=(1in,1in,1in,1in),stepCnt->2,kata version->0.1.0,,kataStepCnt code={\protected macro:#1->\arabic {#1}},pgfk@/tikz/head/.@cmd,pgfk@/tikz/stance/.@cmd,pgfk@/tikz/stance label/.@cmd,pgfk@/tikz/stance label base/.@cmd,pgfk@/tikz/waza/.@cmd,pgfk@/tikz/waza label flipped/.@cmd,pgfk@/tikz/waza label base/.@cmd,pgfk@/tikz/dir/.@cmd,pgfk@/tikz/border/.@cmd,pgfk@/tikz/step counter/.@cmd,
  1. width=3 might require drawing multiple phantom steps -> all use the same extern
Analysis of the generated `memo`s when typesetting the *Extended Example* (plus a simple tikzpicture): 1. 5 externs generated (4 `step`s + 1 `tikzpicture`) ✅ 2. context of the `tikzpicture` is unaltered ✅ ```tex \mmzResource{main.13CA6225EF1CB8B2D15D71140C2A246B-E778DCCCB8AAB0BBD3F6CFEEFD2421F8.pdf}% \mmzMemo \quitvmode \mmzIncludeExtern {0}\hbox {21.94595pt}{13.71594pt}{0.0pt}{72.26999pt}{72.26999pt}{72.26999pt}{72.26999pt}\mmzStepPgfPictureId {1}% \mmzThisContext padding=(1in,1in,1in,1in), \mmzEndMemo ``` 3. Other contexts: ```tex padding=(1in,1in,1in,1in),stepCnt->3,kata version->0.1.0,,kataStepCnt code={\protected macro:#1->\arabic {#1}},pgfk@/tikz/head/.@cmd,pgfk@/tikz/stance/.@cmd,pgfk@/tikz/stance label/.@cmd,pgfk@/tikz/stance label base/.@cmd,pgfk@/tikz/waza/.@cmd,pgfk@/tikz/waza label/.@cmd,pgfk@/tikz/waza label base/.@cmd,pgfk@/tikz/border/.@cmd,pgfk@/tikz/step counter/.@cmd, padding=(1in,1in,1in,1in),stepCnt->0,kata version->0.1.0,,kataStepCnt code={\protected macro:#1->\arabic {#1}},pgfk@/tikz/head/.@cmd,pgfk@/tikz/stance/.@cmd,pgfk@/tikz/stance label/.@cmd,pgfk@/tikz/stance label base/.@cmd,pgfk@/tikz/waza/.@cmd,pgfk@/tikz/waza label/.@cmd,pgfk@/tikz/waza label base/.@cmd,pgfk@/tikz/dir/.@cmd,pgfk@/tikz/border/.@cmd,pgfk@/tikz/step counter/.@cmd, padding=(1in,1in,1in,1in),stepCnt->1,kata version->0.1.0,,kataStepCnt code={\protected macro:#1->\arabic {#1}},pgfk@/tikz/head/.@cmd,pgfk@/tikz/stance/.@cmd,pgfk@/tikz/stance label/.@cmd,pgfk@/tikz/stance label base/.@cmd,pgfk@/tikz/waza/.@cmd,pgfk@/tikz/waza label/.@cmd,pgfk@/tikz/waza label base/.@cmd,pgfk@/tikz/dir/.@cmd,pgfk@/tikz/border/.@cmd,pgfk@/tikz/step counter/.@cmd, padding=(1in,1in,1in,1in),stepCnt->2,kata version->0.1.0,,kataStepCnt code={\protected macro:#1->\arabic {#1}},pgfk@/tikz/head/.@cmd,pgfk@/tikz/stance/.@cmd,pgfk@/tikz/stance label/.@cmd,pgfk@/tikz/stance label base/.@cmd,pgfk@/tikz/waza/.@cmd,pgfk@/tikz/waza label flipped/.@cmd,pgfk@/tikz/waza label base/.@cmd,pgfk@/tikz/dir/.@cmd,pgfk@/tikz/border/.@cmd,pgfk@/tikz/step counter/.@cmd, ``` 4. `width=3` might require drawing multiple phantom steps -> all use the same extern ✅
Author
Owner

is pgfk@/tikz/head/.@cmd, an issue? (does not seem to contain the full style (or is this only a matter of display?)

is `pgfk@/tikz/head/.@cmd,` an issue? (does not seem to contain the full style (or is this only a matter of display?)
Author
Owner

Yes the issue is the following:

\pgfkeys{
  /foo/.cd,
  bar/.style{bar/.meaning to context},
}
\tikz \node[/foo/bar] {};

now the handler .meaning to context is executed on the /tikz/bar key (which is empty) instead on the /foo/bar key.
(would have been evident based on the "key-name/-path" shown in the context printed in the .memo file

Yes the issue is the following: ```tex \pgfkeys{ /foo/.cd, bar/.style{bar/.meaning to context}, } \tikz \node[/foo/bar] {}; ``` now the handler `.meaning to context` is executed on the `/tikz/bar` key (which is empty) instead on the `/foo/bar` key. (would have been evident based on the "key-name/-path" shown in the context printed in the `.memo` file
Author
Owner

Additional issues that came up:

  1. memoize should always be loaded before the custom package (as specified by the memoize docs)
  2. adding \kata@color@* to the context was missing
  3. adding the package version to the context was still missing
  4. use memoizable instead of manually defining stubs

merging tomorrow

Additional issues that came up: 1. `memoize` should always be loaded before the custom package (as specified by the `memoize` docs) 2. adding `\kata@color@*` to the context was missing 3. adding the package version to the context was still missing 4. use `memoizable` instead of manually defining stubs merging tomorrow
Author
Owner

manually merged in 08c107e (regenerated kata.pdf to fixup the conflict -> no automatic merge / no detection of the merge)

manually merged in 08c107e (regenerated `kata.pdf` to fixup the conflict -> no automatic merge / no detection of the merge)
lukas closed this pull request 2026-04-01 10:40:13 +00:00
lukas deleted branch feat-memoize 2026-04-01 10:40:21 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.