Cor*_*mer 2 python latex restructuredtext pdflatex python-sphinx
我有一个脚本可以生成一些数字并将它们放在报告的附录中,例如
Appendix
********
.. figure:: images/generated/image_1.png
.. figure:: images/generated/image_2.png
.. figure:: images/generated/image_3.png
... etc
Run Code Online (Sandbox Code Playgroud)
看起来在大量(约 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}
...
Run Code Online (Sandbox Code Playgroud)
当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.
Run Code Online (Sandbox Code Playgroud)
然后在最后一个成功的图像(~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.
Run Code Online (Sandbox Code Playgroud)
如果我所做的只是减少数字的数量,它就会运行并毫无问题地生成 pdf。一个部分可以拥有的图像数量是否有硬性限制?是否还有其他地方可以查看构建日志以缩小发生这种情况的原因?
这似乎是几件事的结合。
第一个症状本质上是由太多未处理的浮点数引起的错误。对此问题进行修复是下面添加到babel的元素latex_elements
\usepackage[maxfloats=256]{morefloats}
Run Code Online (Sandbox Code Playgroud)
第二个症状是抱怨Output loop---100 consecutive dead cycles.所以解决方法只是增加周期数
\maxdeadcycles=1000
Run Code Online (Sandbox Code Playgroud)
经过这两个调整后pdflatex,即使有大量数字,命令现在也可以成功完成。