首页 > 解决方案 > pdflatex 在大量数字后挂起

问题描述

我有一个脚本可以生成许多数字并将它们放在报告的附录中,例如

Appendix
********

.. figure:: images/generated/image_1.png
.. figure:: images/generated/image_2.png
.. figure:: images/generated/image_3.png
... etc

看起来在大量(〜50)图像之后,我的pdflatex命令将挂起,并指向我.tex文件中的其中一个图形

...
\begin(figure)[htbp]
\centering
\noindent\sphinxincludegraphics{{image_49}.png}
\end{figure}

\begin(figure)[htbp]
\centering
\noindent\sphinxincludegraphics{{image_50}.png} <--- here
\end{figure}

\begin(figure)[htbp]
\centering
\noindent\sphinxincludegraphics{{image_51}.png}
\end{figure}
...

pdflatex失败时,我真的无法从控制台输出中弄清楚要做什么,我得到了一些似乎是好消息的行

<image_48.png, id=451, 411.939pt x 327.3831pt>
File: image_48.png Graphic file (type png)
<use image_48.png>
Package pdftex.def Info: image_48.png  used on input line 1251.
(pdftex.def)             Requested size: 411.93797pt x 327.3823pt.

<image_49.png, id=452, 411.939pt x 327.3831pt>
File: image_49.png Graphic file (type png)     
<use image_49.png>
Package pdftex.def Info: image_49.png  used on input line 1257.
(pdftex.def)             Requested size: 411.93797pt x 327.3823pt.

然后在最后一个成功的图像(〜50)之后它开始输出

! Output loop---100 consecutive dead cycles.
\end@float ...loatpenalty <-\@Mii \penalty -\@Miv
                                                  \@tempdima \prevdepth \vbo...
l.1258 \end{figure}

I've concluded that your \output is awry; it never does a
\shipout, so I'm shipping \box255 out myself. Next time
increase \maxdeadcycles if you want me to be more patient!

[9
! Undefined control sequence.
\reserved@a ->\@nil

l.1258 \end{figure}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

如果我所做的只是减少数字的数量,它将毫无问题地运行并生成 pdf。一个部分可以拥有的图像数量是否有硬性限制?是否有其他地方我可以在构建日志中查看以缩小发生这种情况的原因?

标签: pythonlatexpython-sphinxrestructuredtextpdflatex

解决方案


这似乎是几件事的结合。

第一个症状本质上是由太多未处理的浮点数引起的错误。解决此问题的方法是将以下内容添加babellatex_elements

\usepackage[maxfloats=256]{morefloats}

第二个症状是抱怨,Output loop---100 consecutive dead cycles.所以修复只是增加周期数

\maxdeadcycles=1000

经过这两次调整,pdflatex命令现在可以成功完成,即使是大量的数字。


推荐阅读