memoize-extract(1) | User Manual | memoize-extract(1) |
memoize-extract.pl, memoize-extract.py - Extract extern pages out of the PDF
memoize-extract.pl [OPTIONS] document.mmz
memoize-extract.py [OPTIONS] document.mmz
memoize-extract is a script accompanying Memoize, a TeX package which allows the author to reuse the results of compilation-intensive code such as TikZ pictures.
Memoize dumps the created externs (boxes containing the typeset material to be reused) onto their own pages in the produced PDF file. It is the job of memoize-extract to extract these extern pages into separate PDF files. At subsequent compilations, Memoize will include those extern files into the document, without compiling their source again.
Memoize communicates with memoize-extract through file document.mmz. When document.tex is compiled to produce document.pdf, Memoize produces document.mmz, which records which pages in the produced document are extern pages and to which extern files they should be extracted. Therefore, after compiling document.tex, the externs should be extracted by memoize-extract document.mmz.
document.mmz may also be given as document* or document.tex. When environment variable TEXMF_OUTPUT_DIRECTORY is set, this filename is relative to the output directory specified by this variable.
document.mmz also records the expected width and height of each extern. In case of a mismatch, memoize-extract refuses to extract the page and removes the extern file if it already exist, and prints a warning message to the standard error. The script also refuses to extract the page if a (c)c-memo associated to the extern does not exist. See also section SECURITY.
The Perl (.pl) and the Python (.py) version of the script are functionally equivalent. The Perl script requires library PDF::API2 (https://metacpan.org/pod/PDF::API2), and the Python script requires library pdfrw2 (https://pypi.org/project/pdfrw2).
This script respects the restrictions on file input and output imposed by the TeX configuration, more precisely, the variables openin_any and openout_any of the kpathsea library (https://tug.org/kpathsea). You can inspect the values of these variables by executing `kpsewhich -var-value=openin_any' and `kpsewhich -var-value=openout_any'. The interpretation is as follows:
Other exit codes are as produced by the underlying scripting language (Perl of Python).
Memoize manual (https://ctan.org/pkg/memoize), section 6.6.1.
January 21, 2024 | memoize-extract of Memoize v1.1.2 |