You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PDF build is broken if inside an admonition (warning, caution, attention, danger, error) there is an included image file which a requested height close to or larger than the total text area in a page.
Procedure to reproduce the problem
Test
====
.. attention::
.. image:: rimg.*
:height: 1000px
With this image rimg.png:
(or any image at least about twice taller than wide, so that the Sphinx cap on maximal width to \linewidth does not modify requested height, bigger than text height)
Error logs / results
PDF build crashes after spitting out close to 5000 empty pages.
! TeX capacity exceeded, sorry [input stack size=5000].
\@ifundefined #1->\ifcsname #1
\endcsname \@ifundefin@d@i \else \@ifundefin@d...
l.89 \end{sphinxadmonition}
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on FOO.log.
=== TeX engine is 'pdfTeX'
Latexmk: Index file 'FOO.idx' was written
Latexmk: Errors, so I did not complete making targets
Expected results
The image is either resized or split to not create errors.
Comment
The problem comes from framed.sty : an image can not be split in LaTeX (one can lie to LaTeX about its actual size however, but then it will collide with following paragraph) and an over-sized image is first moved to next page, then framed.sty realizes there is not enough room, the image is again moved to next page, etc... creating infinite loop until some TeX memory is exhausted.
It is not possible to split the image from inside LaTeX, but it is possible to include it multiple times and clip each inclusion to successive horizontal slices. In recent pdftex/xetex this will not increase PDF filesize. However, this is definitely complicated method. See this tex.sx question I posted on a TeX/LaTeX forum.
More reasonable is to modify \sphinxincludegraphics which is the Sphinx provided wrapper of LaTeX \includegraphics to force a maximal image height compatible with standing alone on one page (with the framing). Already, \sphinxincludegraphics forces the width to not exceed \linewidth, so this keeps the same spirit.
Environment info
OS: Mac
Python version: 3.6.6
Sphinx version: 1.8
TeXLive 2018
The text was updated successfully, but these errors were encountered:
Sorry, completely forgot to say this issue originates in spatialaudio/nbsphinx#276. There it arises in a non-Sphinx LaTeX environment, but this environment uses framed.sty analogously to what Sphinx does for code-blocks and admonitions ( of the attention type).
PR spatialaudio/nbsphinx#277 fixes this by using a variant of \sphinxincludegraphics making sure the height of included image will not be too big.
Problem
PDF build is broken if inside an admonition (warning, caution, attention, danger, error) there is an included image file which a requested height close to or larger than the total text area in a page.
Procedure to reproduce the problem
With this image
rimg.png
:(or any image at least about twice taller than wide, so that the Sphinx cap on maximal width to
\linewidth
does not modify requested height, bigger than text height)Error logs / results
PDF build crashes after spitting out close to 5000 empty pages.
Expected results
The image is either resized or split to not create errors.
Comment
The problem comes from
framed.sty
: an image can not be split in LaTeX (one can lie to LaTeX about its actual size however, but then it will collide with following paragraph) and an over-sized image is first moved to next page, thenframed.sty
realizes there is not enough room, the image is again moved to next page, etc... creating infinite loop until some TeX memory is exhausted.It is not possible to split the image from inside LaTeX, but it is possible to include it multiple times and clip each inclusion to successive horizontal slices. In recent pdftex/xetex this will not increase PDF filesize. However, this is definitely complicated method. See this tex.sx question I posted on a TeX/LaTeX forum.
More reasonable is to modify
\sphinxincludegraphics
which is the Sphinx provided wrapper of LaTeX\includegraphics
to force a maximal image height compatible with standing alone on one page (with the framing). Already,\sphinxincludegraphics
forces the width to not exceed\linewidth
, so this keeps the same spirit.Environment info
The text was updated successfully, but these errors were encountered: