2

Note that this question concerns memoize version 1.1.2 (2024-01-21) and, perhaps, later.

memoize version 1.1.2 provides built-in support for automatic handling of \cite and \cites in memoized code when using Biblatex. I'm trying to use this to support a broader range of Biblatex citation macros.

So far I've got many such macros working using the built-in cite and cites styles. For example, his supports \autocite

  auto=\autocite{cite},

I've got a few more at partially working by defining a cite field style which uses a custom outer handler.

    auto/cite field/.style={run if memoizing, args=oomom, outer handler=\mmz@auto@citefield},

For example,

  auto csname={citefield}{cite field},
  auto csname={citelist}{cite field},
  auto csname={citename}{cite field},

with outer handler

\NewDocumentCommand \mmz@auto@citefield { O{} O{} m O{} m}
{% purloined from memoize.sty & mangled
  \xtoksapp\mmzCCMemo{%
    \noexpand\nocite{#3}%
  }%
  \AdviceOriginal[#1][#2]{#3}[#4]{#5}%  
}

However, the context-sensitivity doesn't work correctly so I need

    auto csname={abx@missing}{abort},

and nothing is auto-regenerated if, say, the output of the citation command changes.

What would be the best way to define \mmz@auto@citefield?

MWE:

\documentclass{article}

\usepackage{memoize} \usepackage{biblatex} \bibliography{biblatex-examples} \usepackage{tikz} \makeatletter \mmzset{% prefix=memos/, begindocument/before/.append style={% auto=\autocite{cite}, auto csname={abx@missing}{abort}, auto/cite field/.style={run if memoizing, args=oomom, outer handler=\mmz@auto@citefield}, auto csname={citefield}{cite field}, auto csname={citelist}{cite field}, auto csname={citename}{cite field}, }, } \NewDocumentCommand \mmz@auto@citefield { O{} O{} m O{} m} {% purloined from memoize.sty & mangled \xtoksapp\mmzCCMemo{% \noexpand\nocite{#3}% }% \AdviceOriginal[#1][#2]{#3}[#4]{#5}%
} \makeatother

\begin{document} \begin{tikzpicture} \node [draw] {\autocite{westfahl:space}}; \end{tikzpicture} \begin{tikzpicture} \node [draw] {\citefield{westfahl:space}{booktitle}}; \end{tikzpicture} \begin{tikzpicture} \node [draw] {\citename{westfahl:space}{author}}; \end{tikzpicture} \begin{tikzpicture} \node [draw] {\citelist{westfahl:space}{location}}; \end{tikzpicture} \printbibliography \end{document}

cfr
  • 198,882
  • +1. First time I read of the memoize package. May I ask, what are you using the package for in general? – Dr. Manuel Kuehner Feb 18 '24 at 07:08
  • 1
    @Dr.ManuelKuehner Externalising TikZ images. It is much, much nicer than the standard externalize: more automated, more robust, faster, more secure and the author has not abandoned it. (Not that I know of, anyway.) – cfr Feb 18 '24 at 07:11
  • @Dr.ManuelKuehner See https://tex.stackexchange.com/questions/698404/externalizing-large-tikz-figures/698555#698555 for my introduction to the first CTAN version. (There are some new upsides and downsides in the current version, but this is pretty close.) – cfr Feb 18 '24 at 07:14
  • Thanks a lot, that sounds promising. – Dr. Manuel Kuehner Feb 18 '24 at 07:26

0 Answers0