使用 pspicture 时出现“xdvipdfmx:fatal: 文件过早结束”错误

使用 pspicture 时出现“xdvipdfmx:fatal: 文件过早结束”错误

我在 macOS 10.12 上使用 TeXLive2016 和 TeXstudio 2.12.6。在使用 XeLaTeX 编译包含 pspicture 的文件时,我收到以下消息:

xdvipdfmx:fatal: File ended prematurely Output file removed.

以下是一个示例:

\documentclass[10pt]{article}
\usepackage{pstricks}

\begin{document}
    \begin{pspicture}(0,-1.54)(5.98,1.54)
    \psdots[dotsize=0.09](1.66,1.12)
    \psdots[dotsize=0.09](0.26,-1.28)
    \psdots[dotsize=0.09](4.46,-1.28)
    \psdots[dotsize=0.09](5.86,1.12)
    \psline[linewidth=0.04cm](0.26,-1.28)(1.66,1.12)
    \psline[linewidth=0.04cm](1.66,1.12)(4.46,-1.28)
    \psline[linewidth=0.04cm](4.46,-1.28)(0.26,-1.28)
    \psline[linewidth=0.04cm](5.86,1.12)(4.46,-1.28)
    \usefont{T1}{ppl}{m}{n}
    \rput(1.55,1.31){$2$}
    \usefont{T1}{ptm}{m}{n}
    \rput(4.62,-1.375){$3$}
    \usefont{T1}{ppl}{m}{n}
    \rput(5.83,1.33){$4$}
    \usefont{T1}{ppl}{m}{n}
    \rput(0.04,-1.35){$1$}
    \end{pspicture} 
\end{document}

我搜索了很多,但找不到解决此情况的方法。如果能提供任何建议,我将不胜感激。

编辑:

对于此代码:

\listfiles
\documentclass[10pt]{article}
\usepackage{pstricks}

\begin{document}
\begin{pspicture}(0,-1.54)(5.98,1.54)
\psdots[dotsize=0.09](1.66,1.12)(0.26,-1.28)(4.46,-1.28)(5.86,1.12)
\psline[linewidth=0.04cm](0.26,-1.28)(1.66,1.12)(4.46,-1.28)(0.26,-1.28)
\psline[linewidth=0.04cm](5.86,1.12)(4.46,-1.28)
\rput(1.55,1.31){2}
\rput(4.62,-1.375){3}
\rput(5.83,1.33){4}
\rput(0.04,-1.35){1}
\end{pspicture} 
\end{document}

文件列表为:

*File List*
article.cls    2014/09/29 v1.4h Standard LaTeX document class
size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
pstricks.sty    2015/11/14 v0.62 LaTeX wrapper for `PSTricks' (RN,HV)
xcolor.sty    2016/05/11 v2.12 LaTeX color extensions (UK)
color.cfg    2016/01/02 v1.6 sample color configuration
xetex.def    2016/04/06 v4.08 LaTeX color/graphics driver for XeTeX (TeX Live/RRM/JK)
infwarerr.sty    2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty    2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
pstricks.tex    2016/05/18 v2.66 `PSTricks' (tvz,hv)
pst-xkey.tex    2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
xkeyval.sty    2014/12/03 v2.7a package option processing (HA)
xkeyval.tex    2014/12/03 v2.7a key=value parser (HA)
pst-fp.tex    2016/05/18 v2.66 `PST-fp' (hv)
fontspec.sty    2016/02/01 v2.5a Font selection for XeLaTeX and LuaLaTeX
expl3.sty    2016/05/18 v6512 L3 programming layer (loader) 
expl3-code.tex    2016/05/18 v6512 L3 programming layer 
l3xdvipdfmx.def    
xparse.sty    2016/05/18 v6512 L3 Experimental document command parser
fontspec-xetex.sty    2016/02/01 v2.5a Font selection for XeLaTeX and LuaLaTeX
fontenc.sty
eu1enc.def    2010/05/27 v0.1h Experimental Unicode font encodings
eu1lmr.fd    2009/10/30 v1.6 Font defs for Latin Modern
xunicode.sty    2011/09/09 v0.981 provides access to latin accents and many other characters in Unicode lower plane
eu1lmss.fd    2009/10/30 v1.6 Font defs for Latin Modern
graphicx.sty    2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2016/05/09 v1.0r Standard LaTeX Graphics (DPC,SPQR)
trig.sty    2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg    2016/01/02 v1.10 sample graphics configuration
fontspec.cfg
t3cmr.fd    2001/12/31 TIPA font definitions
***********
 ) 
Here is how much of TeX's memory you used:
 20423 strings out of 493591
 399990 string characters out of 6143545
 386959 words of memory out of 5000000
 23726 multiletter control sequences out of 15000+600000
 3680 words of font info for 19 fonts, out of 8000000 for 9000
 1347 hyphenation exceptions out of 8191
 46i,5n,42p,10348b,226s stack positions out of 5000i,500n,10000p,200000b,80000s

Error 256 (driver return code) generating output;
file document.pdf may not be valid.

更新使用 TeXLive2019 和最新软件包时我仍然遇到同样的问题。

答案1

使用最新的 TL 2017 和 xelatex 我无法看到它。但是,您可以简化代码:

\listfiles
\documentclass[10pt]{article}
\usepackage{pstricks}

\begin{document}
\begin{pspicture}(0,-1.54)(5.98,1.54)
\psdots[dotsize=0.09](1.66,1.12)(0.26,-1.28)(4.46,-1.28)(5.86,1.12)
\psline[linewidth=0.04cm](0.26,-1.28)(1.66,1.12)(4.46,-1.28)(0.26,-1.28)
\psline[linewidth=0.04cm](5.86,1.12)(4.46,-1.28)
\rput(1.55,1.31){2}
\rput(4.62,-1.375){3}
\rput(5.83,1.33){4}
\rput(0.04,-1.35){1}
\end{pspicture} 
\end{document}

文件列表位于日志文件的末尾:

 *File List*
 article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
pstricks.sty    2017/09/17 v0.65 LaTeX wrapper for `PSTricks' (RN,HV)
   iftex.sty    2013/04/04 v0.2 Provides if(tex) conditional for PDFTeX, XeTeX,
 and LuaTeX
shellesc.sty    2016/06/07 v0.02a unified shell escape interface for LaTeX
  xcolor.sty    2016/05/11 v2.12 LaTeX color extensions (UK)
   color.cfg    2016/01/02 v1.6 sample color configuration
   xetex.def    2017/06/24 v5.0h Graphics/color driver for xetex
pst-xkey.tex    2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
pst-xkey.tex    2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)
 xkeyval.sty    2014/12/03 v2.7a package option processing (HA)
 xkeyval.tex    2014/12/03 v2.7a key=value parser (HA)
pstricks.tex    2017/10/04 v2.77 `PSTricks' (tvz,hv)
  pst-fp.tex    2017/10/04 v2.77 `PST-fp' (hv)
pstricks.pro    2017/09/18 v. 1.27, PostScript prologue file (hv)
pst-algparser.pro    2011/10/31 v. 0.04, PostScript prologue file (hv)
pst-tools.pro    2012/01/01 v. 0.02, PostScript prologue file (hv)
pst-dots.pro    2006/12/19 v. 2.00, PostScript prologue file (hv)
 ***********

相关内容