ext/imgmath: batch LaTeX compilation - #14535
Open
jschueller wants to merge 1 commit into
Open
Conversation
jschueller
force-pushed
the
batch
branch
15 times, most recently
from
July 17, 2026 06:39
6c73829 to
8fa3152
Compare
jschueller
marked this pull request as ready for review
July 17, 2026 08:42
Add ``imgmath_batch_size`` config option (default 1). When greater than 1, equations are collected on ``env-updated`` and compiled into multi-page DVI documents before writing, reducing N LaTeX processes to ceil(N/B), then split via ``dvipng -pp`` / ``dvisvgm --page``. Filenames, embed mode, depth handling, and error reporting match single-equation mode. Batching is disabled when a custom ``template.tex``/``preview.tex`` template is detected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
imgmath_batch_sizeconfig option (default 1). When set to a value greater than 1, equations are accumulated and compiled in a single LaTeX invocation using a multi-page DVI withpreviewenvironments, then split viadvipng -page/dvisvgm --page.For a build with N equations and batch_size=B, this reduces N LaTeX process launches to ceil(N/B), keeping resource usage manageable.
For the openturns project (with 8k+ equations), this reduces the sphinx build time from 22m30 to 10m25 (with imgmath_batch_size=128)