pdflatex 在大量数字后挂起

pdflatex hang after large number of figures

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

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。一个部分可以拥有的图像数量是否有硬性限制?我可以在其他地方查看构建日志以缩小发生这种情况的原因吗?

这似乎是几件事的结合。

第一个症状本质上是由 too many unprocessed floats 引起的错误。解决方法是将以下内容添加到 latex_elements

babel 元素中
\usepackage[maxfloats=256]{morefloats}

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

\maxdeadcycles=1000

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

我遇到了这个问题,上面的建议没有用。但是,通过插入可能与您的目标兼容或不兼容的小节,我能够将其设置为 运行 就好了。该脚本生成如下代码,然后将其输入到另一个代码片段中以预览生成的图像, (我正在从 C++ 生成 svg 图,转换为 png,并预览基本原始数据以供选择进入实际文档的后续图,而不仅仅是图像集合)

\subsection{svghappy2.tyrosine.png}
\begin{figure}[htbp]
\testplot{svghappy2_tyrosine.png}
\caption{svghappy2.tyrosine.png}
\end{figure}

\subsection{svghappy2.valine.png}
\begin{figure}[htbp]
\testplot{svghappy2_valine.png}
\caption{svghappy2.valine.png}
\end{figure}

由于编译器很难设置所有图像,所以出现了这个问题。他们之间的分裂会有所帮助。正如@mike-marchywka 指出的那样,部分可能会起到作用,但其他东西也会起作用,例如 placeins

中的 \pagebreak 或 \FloatBarrier