Skip to content

LaTeX: fix #3099#14213

Merged
jfbu merged 1 commit intosphinx-doc:masterfrom
jfbu:latex_3099
Dec 26, 2025
Merged

LaTeX: fix #3099#14213
jfbu merged 1 commit intosphinx-doc:masterfrom
jfbu:latex_3099

Conversation

@jfbu
Copy link
Contributor

@jfbu jfbu commented Dec 26, 2025

Formerly, PDF rendering crashed for inputs of more than about 1350 codelines either from a code-block, or from a literal include, when this literal include used the sphinxVerbatim and not the sphinxalltt route.

The fix goes via novel mark-up which is applied in case the literally included file or code-block contains more than 500 codelines. Then chunks of 500 consecutive source codelines are rendered using:

sphinxLongVerbatimFirst, sphinxLongVerbatimMiddle, and
sphinxLongVerbatimLast.

Efforts have been devoted for line numbering and emphasizing to not be modified, and (if so configured) for bottom captions to appear where expected.

It was needed to (to cut into smaller pieces and) modify in a very limited manner the legacy sphinxVerbatim which is still used for up to 500 codelines, which corresponds to about 10 a4-sized pages, if document is with default pointsize and margins.

Hopefully no consequences will arise from these changes.

Known issue: in the unlikely event a pagebreak happens exactly after a chunk of 500 code lines, the continuation hints usually printed at bottom and top of pages are omitted.

Fix #3099

Formerly, PDF rendering crashed for inputs of more than about 1350
codelines either from a code-block, or from a literal include, when this
literal include used the sphinxVerbatim and not the sphinxalltt route.

The fix goes via novel mark-up which is applied in case the literally
included file or code-block contains more than 500 codelines.  Then
chunks of 500 consecutive source codelines are rendered using:

    sphinxLongVerbatimFirst, sphinxLongVerbatimMiddle, and
    sphinxLongVerbatimLast.

Efforts have been devoted for line numbering and emphasizing to not be
modified, and (if so configured) for bottom captions to appear where
expected.

It was needed to (to cut into smaller pieces and) modify in a very
limited manner the legacy sphinxVerbatim which is still used for up to
500 codelines, which corresponds to about 10 a4-sized pages, if document
is with default pointsize and margins.

Hopefully no consequences will arise from these changes.

Known issue: in the unlikely event a pagebreak happens exactly after a
chunk of 500 code lines, the continuation hints usually printed at
bottom and top of pages are omitted.
@jfbu jfbu added this to the 9.1.0 milestone Dec 26, 2025
@jfbu jfbu merged commit 621f58d into sphinx-doc:master Dec 26, 2025
27 of 28 checks passed
@jfbu jfbu deleted the latex_3099 branch December 26, 2025 15:53
jfbu added a commit to jfbu/sphinx that referenced this pull request Dec 26, 2025
jfbu added a commit that referenced this pull request Dec 26, 2025
AA-Turner pushed a commit to pradyunsg/sphinx that referenced this pull request Dec 31, 2025
Formerly, PDF rendering crashed for inputs of more than about 1350
codelines either from a code-block, or from a literal include, when this
literal include used the sphinxVerbatim and not the sphinxalltt route.

The fix goes via novel mark-up which is applied in case the literally
included file or code-block contains more than 500 codelines. Then
chunks of 500 consecutive source codelines are rendered using:

sphinxLongVerbatimFirst, sphinxLongVerbatimMiddle, and
sphinxLongVerbatimLast.

Efforts have been devoted for line numbering and emphasizing to not be
modified, and (if so configured) for bottom captions to appear where
expected.

It was needed to (to cut into smaller pieces and) modify in a very
limited manner the legacy sphinxVerbatim which is still used for up to
500 codelines, which corresponds to about 10 a4-sized pages, if document
is with default pointsize and margins.

Hopefully no consequences will arise from these changes.

Known issue: in the unlikely event a pagebreak happens exactly after a
chunk of 500 code lines, the continuation hints usually printed at
bottom and top of pages are omitted.
AA-Turner pushed a commit to pradyunsg/sphinx that referenced this pull request Dec 31, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

literalinclude xml: TeX capacity exceeded, sorry [main memory size=3000000].

1 participant