pstool,pdfLaTeX:无法让 pstool 工作,“LaTeX 错误:找不到文件”

pstool,pdfLaTeX:无法让 pstool 工作,“LaTeX 错误:找不到文件”

我花了很多时间尝试自己解决问题。不幸的是,似乎没有其他人遇到过同样的问题。至少,在各种论坛上搜索和使用谷歌都没有帮助。所以我们开始吧:

我想使用和将 MATLAB 图形合并到我的论文中matlabfragpstool但我仍然无法让它工作。我的设置是 Windows 7 + MiKTeX 2.9 + 最新更新 + TeXnicCenter。

MATLAB代码:

figure(1), clf;
plot([1 2]);
ylabel('A straight line');
matlabfrag('testpic');

LaTeX 示例:

\documentclass{article}
\usepackage{pstool}

\begin{document}
\psfragfig{testpic}
\end{document}

调用pdflatex-shell-escape产生以下错误:

! LaTeX Error: File `./testpic' not found.

另外还有日志文件

I could not locate the file with any of these extensions:
.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPEG,.JBIG2,.JB2

我附上了.log制作的\listfiles

第一个错误与我尝试输入带有.eps\includegraphics的错误相同pdflatex。因此,我假设pstool或 之间的任何内容都不会生成testpic.pdf编译器正在寻找的 。

进一步说明:

  • 当呼叫时latex-shell-escape一切正常
  • 我在三台不同的机器上尝试了上述示例,这些机器都具有相同的设置,并且还使用了 TexMaker。结果总是相同的,这让我更加困惑,因为我找不到遇到同样问题的人。

因此,我想我犯了一个一般的系统错误,但我没有发现。希望你能发现。

- - - - - 日志档案 - - - - -

This is pdfTeX, Version 3.1415926-2.4-1.40.13 (MiKTeX 2.9) (preloaded format=pdflatex 2012.6.15)  16 JUN 2012 13:38
entering extended mode
**C:/Users/Michael/Desktop/Minimalbeispiel/Minimalbeispiel.tex
(C:/Users/Michael/Desktop/Minimalbeispiel/Minimalbeispiel.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, afrikaans, ancientgreek, ar
abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic, 
croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga
lician, german, german-x-2012-05-30, greek, gujarati, hindi, hungarian, iceland
ic, indonesian, interlingua, irish, italian, kannada, kurmanji, latin, latvian,
 lithuanian, malayalam, marathi, mongolian, mongolianlmc, monogreek, ngerman, n
german-x-2012-05-30, nynorsk, oriya, panjabi, pinyin, polish, portuguese, roman
ian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, swissgerm
an, tamil, telugu, turkish, turkmen, ukenglish, ukrainian, uppersorbian, usengl
ishmax, welsh, loaded.
("C:\Program Files\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex\latex\base\size10.clo"
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(C:\Users\Michael\AppData\Roaming\MiKTeX\2.9\tex\latex\pstool\pstool.sty
Package: pstool 2009/07/17 v1.3 Wrapper for processing PostScript/psfrag figure
s

("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\catchfile.sty"
Package: catchfile 2011/03/01 v1.6 Catch the contents of a file (HO)

("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty"
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO)
)
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty"
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
)
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\etexcmds.sty"
Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)

("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifluatex.sty"
Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO)
Package ifluatex Info: LuaTeX not detected.
)
Package etexcmds Info: Could not find \expanded.
(etexcmds)             That can mean that you are not using pdfTeX 1.50 or
(etexcmds)             that some package has redefined \expanded.
(etexcmds)             In the latter case, load this package earlier.
))
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\color.sty"
Package: color 2005/11/14 v1.0j Standard LaTeX Color (DPC)

("C:\Program Files\MiKTeX 2.9\tex\latex\00miktex\color.cfg"
File: color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
)
Package color Info: Driver file: pdftex.def on input line 130.

("C:\Program Files\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
\Gread@gobject=\count87
))
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifpdf.sty"
Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO)
Package ifpdf Info: pdfTeX in PDF mode is detected.
)
(C:\Users\Michael\AppData\Roaming\MiKTeX\2.9\tex\latex\ifplatform\ifplatform.st
y
Package: ifplatform 2010/10/22 v0.4 Testing for the operating system
 ("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\pdftexcmds.sty"
Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO
)
Package pdftexcmds Info: LuaTeX not detected.
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
))
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)

("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\keyval.sty"
Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
\KV@toks@=\toks14
)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)

("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\trig.sty"
Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
)
("C:\Program Files\MiKTeX 2.9\tex\latex\00miktex\graphics.cfg"
File: graphics.cfg 2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
)
Package graphics Info: Driver file: pdftex.def on input line 91.
)
\Gin@req@height=\dimen103
\Gin@req@width=\dimen104
)
(C:\Users\Michael\AppData\Roaming\MiKTeX\2.9\tex\latex\psfrag\psfrag.sty
Package: psfrag 1998/04/11 v3.04 PSfrag (MCG)
\pfg@pcount=\count88
\pfg@scount=\count89
\pfg@temp=\write3
)
(C:\Users\Michael\AppData\Roaming\MiKTeX\2.9\tex\latex\bigfoot\suffix.sty
Package: suffix 2006/07/15 1.5 Variant command support
)
("C:\Program Files\MiKTeX 2.9\tex\latex\xkeyval\xkeyval.sty"
Package: xkeyval 2008/08/13 v2.6a package option processing (HA)

("C:\Program Files\MiKTeX 2.9\tex\generic\xkeyval\xkeyval.tex"
\XKV@toks=\toks15
\XKV@tempa@toks=\toks16
\XKV@depth=\count90
File: xkeyval.tex 2008/08/13 v2.6a key=value parser (HA)
))
\pstool@out=\write4
)
(C:\Users\Michael\Desktop\Minimalbeispiel\Minimalbeispiel.aux)
LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 40.
LaTeX Font Info:    ... okay on input line 40.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 40.
LaTeX Font Info:    ... okay on input line 40.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 40.
LaTeX Font Info:    ... okay on input line 40.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 40.
LaTeX Font Info:    ... okay on input line 40.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 40.
LaTeX Font Info:    ... okay on input line 40.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 40.
LaTeX Font Info:    ... okay on input line 40.

(C:\Users\Michael\AppData\Roaming\MiKTeX\2.9\tex\context\base\supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count91
\scratchdimen=\dimen105
\scratchbox=\box26
\nofMPsegments=\count92
\nofMParguments=\count93
\everyMPshowfont=\toks17
\MPscratchCnt=\count94
\MPscratchDim=\dimen106
\MPnumerator=\count95
\everyMPtoPDFconversion=\toks18
)
runsystem(echo "

=== pstool: begin processing ===")...executed.

runsystem(cd "./" & latex -shell-escape -output-format=dvi -output-directory=".
/" -interaction=batchmode  "testpic-pstool.tex" & call echo ^%ERRORLEVEL^%> pst
ool-statusfile.txt)...executed.

 (C:\Users\Michael\Desktop\Minimalbeispiel\pstool-statusfile.txt)
runsystem(cd "./"& del "pstool-statusfile.txt" )...executed.

runsystem(cd "./" & dvips -q -Ppdf  "testpic-pstool.dvi" & call echo ^%ERRORLEV
EL^%> pstool-statusfile.txt)...executed.


(C:\Users\Michael\Desktop\Minimalbeispiel\pstool-statusfile.txt)
runsystem(cd "./"& del "pstool-statusfile.txt" )...executed.

runsystem(cd "./" & ps2pdf "-dAutoFilterColorImages=false" "-dAutoFilterGrayIma
ges=false" "-dColorImageFilter=/FlateEncode" "-dGrayImageFilter=/FlateEncode" "
-dPDFSETTINGS=/prepress" "testpic-pstool.ps" "testpic.pdf" & call echo ^%ERRORL
EVEL^%> pstool-statusfile.txt)...executed.


(C:\Users\Michael\Desktop\Minimalbeispiel\pstool-statusfile.txt)
runsystem(cd "./"& del "pstool-statusfile.txt" )...executed.

runsystem(cd "./"& del "testpic-pstool.tex" )...executed.

runsystem(cd "./"& del "testpic-pstool.dvi" )...executed.

runsystem(cd "./"& del "testpic-pstool.ps" )...executed.

runsystem(cd "./"& del "testpic-pstool.log" )...executed.

runsystem(cd "./"& del "testpic-pstool.aux" )...executed.



! LaTeX Error: File `./testpic' not found.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.42 \end
         {document}
I could not locate the file with any of these extensions:
.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPEG,.JBIG2,.JB2
Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.

runsystem(echo "
=== pstool: end processing ===
")...executed.

(C:\Users\Michael\Desktop\Minimalbeispiel\Minimalbeispiel.aux)

 *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
  pstool.sty    2009/07/17 v1.3 Wrapper for processing PostScript/psfrag figure
s
catchfile.sty    2011/03/01 v1.6 Catch the contents of a file (HO)
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
   color.sty    2005/11/14 v1.0j Standard LaTeX Color (DPC)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
ifplatform.sty    2010/10/22 v0.4 Testing for the operating system
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
graphicx.sty    1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
  psfrag.sty    1998/04/11 v3.04 PSfrag (MCG)
  suffix.sty    2006/07/15 1.5 Variant command support
 xkeyval.sty    2008/08/13 v2.6a package option processing (HA)
 xkeyval.tex    2008/08/13 v2.6a key=value parser (HA)
supp-pdf.mkii
./pstool-statusfile.txt
./pstool-statusfile.txt
./pstool-statusfile.txt
 ***********

 ) 
Here is how much of TeX's memory you used:
 1688 strings out of 493921
 24304 string characters out of 3147276
 76663 words of memory out of 3000000
 4967 multiletter control sequences out of 15000+200000
 3640 words of font info for 14 fonts, out of 3000000 for 9000
 841 hyphenation exceptions out of 8191
 32i,1n,32p,465b,119s stack positions out of 5000i,500n,10000p,200000b,50000s

No pages of output.
PDF statistics:
 0 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)

答案1

简单测试用例latex源码

\documentclass{article} 
\usepackage{pstool}
\begin{document}   
\begin{figure}     
\centering  
\psfragfig*{comparison01-matlabfrag} 
\end{figure}
\end{document}

错误日志文件(Windows 7 上的 texlive 2011):

This is pdfTeX, Version 3.1415926-2.3-1.40.12 (Web2C 2011) (format=pdflatex 2012.6.5)  15 JUN 2012 16:31
entering extended mode
 \write18 enabled.
 %&-line parsing enabled.
**learningexamnew.tex
(./learningexamnew.tex

Package grfext Info: Graphics extension search list:
(grfext)             [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE
G,.JBIG2,.JB2,.eps]
(grfext)             \AppendGraphicsExtensions on input line 452.

(c:/texlive/2011/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
e
))
runsystem(echo "

=== pstool: begin processing ===")...executed.

\openout4 = `./comparison01-matlabfrag-pstool.tex'.

runsystem(cd "./" & latex -shell-escape -output-format=dvi -output-directory=".
/" -interaction=batchmode  "comparison01-matlabfrag-pstool.tex" & call echo ^%E
RRORLEVEL^%> pstool-statusfile.txt)...executed.


(./pstool-statusfile.txt)
runsystem(cd "./"& del "pstool-statusfile.txt" )...executed.


! Missing number, treated as zero.
<to be read again> 
                   T
l.7 \end
        {figure}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Missing = inserted for \ifnum.
<to be read again> 
                   T
l.7 \end
        {figure}
I was expecting to see `<', `=', or `>'. Didn't.

! Missing number, treated as zero.
<to be read again> 
                   T
l.7 \end
        {figure}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Missing { inserted.
<to be read again> 
                   e
l.7 \end
        {figure}
A left brace was mandatory here, so I've put one in.
You might want to delete and/or insert some corrections
so that I will find a matching right brace soon.
(If you're confused by all this, try typing `I}' now.)

)
Runaway text?
enabled. entering extended mode "eERRORLEVELe" > \z@ \PackageWarning \ETC.
! File ended while scanning text of \write.
<inserted text> 
                }
<*> learningexamnew.tex

I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.

! Emergency stop.
<*> learningexamnew.tex

(job aborted, no legal \end found)

在使用 pdflatex shell-escape 选项时,我遇到了与 pstool 类似的问题。我曾使用 matlabfrag 从 Matlab 生成 .eps 和 .tex 图形。问题始于我在 2011 年 5 月 30 日(大约)更新 Miktex 软件包时,当时 Ghostscrpit bin 已更新。

之前用pstool包生成图片的辅助进程没问题,我已经把这个问题发邮件给Pstool的开发者了(https://tex.stackexchange.com/users/179/will-robertson)。

我正在等待 Will Robertson 的回复。问题可能是由于ifplatform操作系统的软件包识别

我已经在 Linux 上使用 texlive 2011 进行了检查,它运行良好。Windows 上的 pstool 存在问题,最新版本的 miktex 2.9 以及 Windows 上的 PDFLATEX 路径中的 texlive 2011 也存在问题。对于 Windows 上的 texlive 2011,此处报告了问题 texlive shell 使用 psfrag 转义的问题 (也许两个问题可以合并为一个)

当我使用选项 [cleanup={}] 检查时,您可以在辅助进程中分析问题。对我来说,它停止在 Postscript 图形创建处。通常它应该创建包含文本的 Postscript 文件的 PDF。我猜想是 Ghostscript 二进制文件没有被 pstool 的辅助进程正确选择。在 ps2pdf 操作附近。我花了很多时间调试问题并在谷歌上搜索解决方案。

如果我们通过 Latex-DVI 路线。pstool 对我来说很好用。但我的 .tex 文件中有很多 .png 文件。因此我选择 pdflatex 路线。

解决方法是应用 latex-dvi 直到我们获得具有适当文本字体的 PDF,然后照常运行 pdflatex。

我已经暂时切换到 Linux 来从事这个项目,直到 Miktex 或 pstool 作者提供解决方案。

答案2

我在使用时遇到了同样的问题latexfigureMatlab 脚本(依赖于pstool),我设法找到了解决方法。

问题原因

问题在于pstool(当前版本 v1.3)内部调用的方式ps2pdf,以及它如何将参数传递给ps2pdf另一个问题解决这个问题ps2pdf问题。基本上,在 Windows 下,传递参数时必须将符号替换为符号ps2pdf,例如=#

ps2pdf -dPDFSETTINGS=/prepress "TEMPxxxx-pstool.ps"

必须修改为

ps2pdf -dPDFSETTINGS#/prepress "TEMPxxxx-pstool.ps"

让命令起作用。

我不知道从什么时候开始需要这个,无论如何,这个=标志现在对我来说不起作用。

使固定

为了解决当前版本(v1.3)的问题pstool,我在里面做了以下更改pstool.sty

  • 我替换了第 62 至 65 行:

    "-dAutoFilterColorImages=false"
    "-dAutoFilterGrayImages=false"
    "-dColorImageFilter=/FlateEncode"
    "-dGrayImageFilter=/FlateEncode" % space
    

    包括以下内容:

    -dAutoFilterColorImages\#false
    -dAutoFilterGrayImages\#false
    -dColorImageFilter\#/FlateEncode
    -dGrayImageFilter\#/FlateEncode % space
    
  • 我替换了第 69-72 行:

    "-dAutoFilterColorImages=false"
    "-dAutoFilterGrayImages=false"
    "-dColorImageFilter=/DCTEncode"
    "-dGrayImageFilter=/DCTEncode" % space
    

    包括以下内容:

    -dAutoFilterColorImages\#false
    -dAutoFilterGrayImages\#false
    -dColorImageFilter\#/DCTEncode
    -dGrayImageFilter\#/DCTEncode % space
    
  • 我替换了第 91 行:

    ps2pdf-options={"-dPDFSETTINGS=/prepress"},
    

    如下所示:

    ps2pdf-options={-dPDFSETTINGS\#/prepress},
    

此修复程序适用于我的装有 Windows 7 和 MiKTeK 2.9 (x64,但这没关系) 的 PC。

我会让的维护人员pstool知道这个修复,也许这会帮助他们pstool在短时间内发布一个新的修复版本。

答案3

我理解你的目标是在 latex 文件中插入 matlab 图形,然后通过 pdflatex 生成 pdf 文件。你的朋友可以matlab2tikz(将你的 matlab 图形转换为 tikz 代码)和/或matfig2pgf(转换成 pgf 代码)。这样生成的 tikz/pgf 代码可以插入到您的 latex 文件中\input,您可以直接使用 pdflatex。

相关内容