Skip to content
cfr42 edited this page Nov 29, 2024 · 10 revisions

This page lists some commands and environments, marking the issues they present to memoization, and providing solutions where possible. (On this page, "manual" refers to the Memoize manual, which can be found at http://mirrors.ctan.org/macros/generic/memoize/doc/memoize-doc.pdf.)

Each entry marks the category of the issue which the package, command or environment presents to Memoize:

  • Memoization: The code resists memoization, in one way or another. Two common causes are category code changes (addressable by key verbatim) and vertical mode (addressable by key capture=vbox). A more complicated example would be code which either produces no externs, or multiple externs; see manual section 4.4.
  • Dependencies: The code submitted to memoization contains a command which refers to "the outside world", like a cross-reference or a command whose definition might change. The memoized code should be recompiled if the cross-reference or the definition of the command changes. The canonical example is \ref.
  • Effects: The memoized code has effects other than just producing typeset material. For example, it might update some global counter, or update a cross-reference. The canonical example is \label. (This is really a subcategory of memoization issues.)
  • Auto: This pertains to commands which are memoized automatically, by submitting them to key auto; see manual section 2.3 and the cross-references therein. The issue is how to determine where the invocation of the command stops, i.e. what are its arguments?
    • Some commands conform to the LaTeX3 argument specification (even if they are not defined in a LaTeX3 way; note that LaTeX3-style commands never require any user intervention); these can be addressed by auto-key args, see manual section 2.3 and the cross-references therein.
    • Commands with weird argument structure require a dedicated collector or such, see manual section 4.5. The canonical example is \tikz.
  • Version: memoize requires a particular version of a third-party package, typically because updated versions have been modified to work with memoize.
    • In some cases, the specified version may be required for auto-memoization of commands or environments provided by the package. An example is prooftrees.
    • In others, the specified version is also or instead required to avoid errors when memoize is loaded. prooftrees is an example of the former.
  • Incompatible: memoize must not be loaded (or, if loaded must be disabled). One example is the standalone class.
Package Command or environment Issue Notes
LaTeX \ref dependencies Automatically loaded built-in support; see manual section 3.3.
\label effects Automatically loaded built-in support; see manual sections 4.2.1 and 4.2.3.
verbatim memoization Use verbatim and capture=vbox.
hyperlinks memoization Hyperlinks do not survive memoization. Disable Memoize in the final version of the document, best by loading package nomemoize instead of memoize; see manual section 2.10.
Algorithmic algorithmic memoization Use capture=vbox.
Beamer other In Beamer class, load Memoize by \RequirePackage before \documentclass{beamer}
dependencies Automatically loaded built-in support; see manual sections 5.7.4, 2.7 and 4.2.4. Use per overlay to produce a separate extern for each overlay.
Biblatex dependencies Built-in support can be loaded by executing key biblatex; see manual section 5.7.5.
Forest Automatically loaded built-in support: environment forest and command \Forest are automemoized; see manual section 5.7.3.
PGF effects Automatically loaded built-in support; see manual section 5.7.1.
Prooftrees version Requires version 0.9 or later; memoize breaks earlier versions.
prooftree or tableau auto Automatically loaded support in package: either environment prooftree or environment tableau are automemoized; see package manual.
Standalone Package works; class does not.
standalone (pkg) No support required.
standalone (class) incompatible Not supported: do not load memoize.
Tcolorbox keys breakable and float memoization Tcolorboxes applying these keys cannot be memoized. Automatically switching memoization off for these and only these boxes is non-trivial. An attempt is made in memoize-doc.sty, used to typeset Memoize documentation. Full support can most likely only be implemented from within tcolorbox itself.
TikZ Automatically loaded built-in support: environment tikzpicture and command \tikz are automemoized; see manual section 5.7.3.
\tikz auto Automatically loaded built-in support: a dedicated collector; see manual section 5.7.2.
remember picture memoization Pictures using this key cannot be externalized; see manual section 3.1.
\matrix memoization Use verbatim.
TikZ-cd tikzcd memoization Use verbatim.
todo \todo, \Todo dependencies More complex setup needed. Refer to this issue. Note: The fix needs a quite recent version of memoize (as of 2024-10-21)
Clone this wiki locally