[Tex/LaTex] pstool, pdfLaTeX: Not getting pstool to work, “LaTeX Error: File not found”

graphicsMATLABpdftex

I've spent lots of hours trying to solve a problem by myself. Unfortunately it seems that no one else has experienced the same problem. At least, searching through various forums and employing Google did not help. So there we go:

I want to incorporate MATLAB figures into my thesis using matlabfrag and pstool and I still havn't been able to get it to work. My setup is Windows 7 + MiKTeX 2.9 + newest updates + TeXnicCenter.

MATLAB code:

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

LaTeX example:

\documentclass{article}
\usepackage{pstool}

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

Calling pdflatex with -shell-escape produces the following error(s):

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

and additionally from the logfile

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

I attached the .log produced with \listfiles.

The first error is the same as if I were trying to input an .eps with \includegraphics and pdflatex. Thus I assume that pstool or whatever in between does not generate the testpic.pdf the compiler is looking for.

Further annotations:

  • When calling latex with -shell-escape, everything works fine
  • I tried the above example on three different machines with the same setup and also with TexMaker. Always the same result, which puzzles me even more due to the fact I was not able to locate anybody else having the same problem.

Thus I suppose I'm doing a general systematic error but I do not see it. Hopefully you do.

———- Logfile ———-

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)

Best Answer

Simple test case latex source

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

Errors logfile( texlive 2011 on windows 7):

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)

I had similar problem with pstool, while working with pdflatex shell-escape options. I have used matlabfrag to generate .eps and .tex figures from Matlab. The problem started when i update the Miktex packages on 30 May 2011 (Approx) when Ghostscrpit bin was updated.

Before that the auxillary process of generating pictures was fine with pstool package. I have mailed the problem to the Developer of Pstool(https://tex.stackexchange.com/users/179/will-robertson).

I am waiting for the reply from Will Robertson. The problem may be due to ifplatform package recognition for the OS

I have checked on Linux with texlive 2011, its working fine. There is problem of pstool on Windows, with miktex 2.9 latest and also with texlive 2011 on windows in the PDFLATEX route. For a texlive 2011 on windows, there is problem reported here texlive shell escape problems with psfrag (May be both questions can be combined as one)

When i checked with options [cleanup={}], you can analyze the problem in auxillary process. For me it stops at Postscript figure creation. Normally it should create a PDF of the text included postscript file. My guess would be Ghostscript binary are not picked properly by the auxillary process of pstool. Somewhere around ps2pdf operation. I spent a lot of time debugging the problem and googling for solutions.

If we go through the Latex-DVI route. pstool works fine for me. But i have lot of .png files in my .tex file. Hence i choose pdflatex route.

The workaround would be apply latex-dvi until we get the PDF with proper text font and then run pdflatex asusual.

I have switched to linux to work on this project temporarily until there would be some solution from Miktex or pstool authors.