Skip to main content

Module intermediate_files

Module intermediate_files 

Source
Expand description

§Intermediate files

Besides the output you ask for (--dest, the images and stylesheets beside it, and the log), a conversion writes the files below. Caches are kept between runs and are always safe to delete. Scratch files are removed when a run ends, including on a timeout or a memory stop. A run that is killed or interrupted (Ctrl+C) can leave scratch behind; those files are dot-named or sit in the system temp directory, and are safe to delete. None of them is ever packed into a .zip or EPUB output.

$TMPDIR below is the system temp directory; $XDG_CACHE_HOME defaults to ~/.cache. The variables that move or turn off a cache are described in ENVIRONMENT.md.

§Caches (kept between runs)

FileWhereWhat it holds
LaTeXML-oxide.cache (and, while a run has it open, -wal/-shm)the destination directoryThe names given to the document’s images (Perl latexmlpost’s LaTeXML.cache, as SQLite), so a reconversion reuses them and documents converted into one folder never share a name. Not written under --nocache, for a .zip or EPUB destination, nor by cortex_worker or the editor server; deleting it only means names are given afresh, past the files already in the folder.
graphics/<aa>/<hash>.<ext>, its .dims sidecar, .prune.lock, .usage$XDG_CACHE_HOME/latexml-oxide/ (LATEXML_GRAPHICS_CACHE_DIR moves it)Converted images keyed by their content, reused by later conversions; each destination gets its own copy. Capped at LATEXML_GRAPHICS_CACHE_MAX_MB (2048 MiB): .usage tallies the bytes, and a prune past the cap leaves 90 % of it; LATEXML_GRAPHICS_CACHE_OFF=1 turns it off.
<version>-<executable>-<tree>/ with .lock, .last_used, .inuse, .partial, .attempts.*, .failed.* files; .binaries/ (with .last_prune, .prune.lock)$LATEXML_FORMAT_CACHE, else $XDG_CACHE_HOME/latexml-oxide/formats/, else ~/.cache/latexml-oxide/formats/, else $TMPDIR/latexml-oxide-formats-<uid>/Format dumps built for a TeX tree that the binary has no embedded dump for. One set per binary build (named by the executable’s content, so a copy of the binary shares it; .binaries/ remembers each file’s digest) and tree. Pruned once a day: another build’s or tree’s set unused for 30 days goes, except the three last used; a directory not named as a set or holding other files is never removed (one that gains another file while it is being pruned stays, renamed .trash-…).
latexml-oxide-dumps-<hash>-<uid>/<kind>.<year>.dump.txt$TMPDIRThe binary’s embedded dumps, unpacked once so concurrent processes share them. Not pruned.
latexml_lua_prelude_<uid>_<hash>.lua$TMPDIRThe sandbox prelude of \directlua, shared by concurrent processes. Not pruned.

§Scratch (one run)

FileWhereWhen
.tmpXXXXXX/$TMPDIRThe source is a .zip or .tar(.gz) archive: it is unpacked here.
.latexml-spill-<pid>-<seq>/segment-*.xmlthe source directory, else $TMPDIR when that is not writableA very large document is converted in streaming mode.
.latexml-writable-<pid>the source directoryChecks that the directory is writable; removed at once.
latexml-post-handoff-<pid>.xmlbeside the destination, else $TMPDIRThe core result, handed to post-processing.
.latexml-post-pages-XXXXXX/ (page-*.xml, and for a parallel render LaTeXML-render.db, render-manifest-<n>.json)beside the destination, else $TMPDIRPost-processing: the pages of a split document, and the shared data of parallel render workers.
.<stem>.tmp.<pid>.<seq>.<ext>the destination directoryEvery output file is written under this name, then renamed into place.
.<stem>.<pid>-<seq>.mutool_svg/, .mutool.png, .pdftocairo.png, Ghostscript and ps2pdf temporaries, .<stem>.<n>.fonts.epsthe destination directoryConverting a PDF, PostScript or EPS image. ImageMagick and Ghostscript also keep their own temporaries in $TMPDIR.
.tmpXXXXXX/ (mimetype, META-INF/, OPS/, …)$TMPDIRAssembling a .zip or EPUB destination.

The log, <name>.latexml.log (latexml.log for literal input), is written to the current directory unless --log names another file; each run replaces it.

§Written by the document itself

\openout, \write and filecontents write to an in-memory file store, never to disk, and \write18 runs nothing. One exception: Lua code run by \directlua may write files with io.open, but only under relative paths in the source directory (no .., no dot-files). These files are never removed.

§cortex_worker

FileWhereWhat it holds
.tmpXXXXXX/$TMPDIR, or the harness slotOne paper’s source and outputs.
cortex_output_<pid>_<seq>.zip$TMPDIR, or the harness slotOne paper’s result, before it is sent to the dispatcher.
cortex_harness_XXXX/ (harness.lock, child-*.claim, a log mirror of at most 8 MiB, slot-NN/)$TMPDIRThe harness’s state while it runs; a stale one is removed when the next harness starts.