输入

输入

有时候,我正在工作,突然就xelatex无法工作了,提示“我无法在文件“test.pdf”上写入”。但为什么呢?是我做的错事吗?我侮辱 xelatex 了吗?现在它甚至无法编译我的 test.tex。

这是 XeTeX,版本 3.1415926-2.2-0.9995.2(TeX Live 2009/Debian)(格式=xelatex 2011.4.22)。Ubuntu 10.04。

输入

\documentclass{article}
\usepackage{fontspec,xltxtra,xunicode}
\setmainfont{Inconsolata}
\begin{document}
hello world
\end{document}

错误

LaTeX Font Info:    Overwriting math alphabet `\mathsf' in version `bold'
(Font)                  OT1/cmss/bx/n --> EU1/lmss/bx/n on input line 4.
LaTeX Font Info:    Overwriting math alphabet `\mathtt' in version `bold'
(Font)                  OT1/cmtt/m/n --> EU1/lmtt/bx/n on input line 4.
 [1
! I can't write on file `test.pdf'.
(Press Enter to retry, or Control-D to exit; default file extension is `.pdf')
Please type another file name for output: 
! Emergency stop.
<to be read again> 
                   \endgroup \set@typeset@protect 
l.6 \end{document}

End of file on the terminal!


Here is how much of TeX's memory you used:
 5003 strings out of 495724
 81422 string characters out of 1189346
 150108 words of memory out of 3000000
 8144 multiletter control sequences out of 15000+50000
 3664 words of font info for 17 fonts, out of 3000000 for 9000
 28 hyphenation exceptions out of 8191
 40i,4n,27p,455b,147s stack positions out of 5000i,500n,10000p,200000b,50000s
No pages of output.

这一切的不一致

十分钟后(现在),经过一番修改,它成功了。所以我删除了文件的内容,并粘贴了我在这里发布的内容,它成功了。然后我删除了test.*除 tex 文件之外的内容,再次尝试 xelatex,但它不起作用。修改是将 tex 文件更改为:

\documentclass[12pt,letterpaper]{article}

 \usepackage{fontspec}% provides font selecting commands
 \usepackage{xunicode}% provides unicode character macros
 \usepackage{xltxtra} % provides some fixes/extras

 \setromanfont[Mapping=tex-text]{Inconsolata}
\begin{document}
hello world
\end{document}

strace -f

Strace 在“无法创建 PDF”行之前显示内存错误。我正在尝试添加更多交换空间。目前我的系统只剩下最后 300-400 MiB 的内存,而且我发现xelatex使用了超过 200 MiB 的内存。这意味着再多几个浏览器选项卡或另一个 PDF 窗口可能会搞砸一切。

clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7887738) = -1 ENOMEM (Cannot allocate memory)`.

答案1

! I can't write on file `skills.pdf'.

在这种情况下,错误是由于内存不足引起的。clone(...) = -1 ENOMEM (Cannot allocate memory)strace 的错误促使我检查内存使用情况。在有 150M 可用内存的情况下运行 xelatex 会引发 write/clone() 错误。在至少有 500M 可用内存的情况下运行可以始终避免该错误。我还没有进行足够的实验来确切知道多少可用内存才足够,但我认为这也取决于 tex 文件的复杂性。

为了补偿,我创建了一个交换文件(仅供参考,我通常没有这个文件)。

dd if=/dev/zero of=/var/512mb.swap bs=1M count=512
mkswap /var/512mb.swap
swapon /var/512mb.swap

相关内容