1

I am writing my thesis, and for this, I have downloaded my institute's latex template to work with. I have been getting an error with the compilation since the first ever unedited run of the template itself. I am using MikTex with TexWorks on Windows 10.

The MWE for my problem (myscript.tex) is:

\documentclass{book}

\usepackage[pspdf={-dAutoRotatePages=/None},pdfcrop={ --hires}]{auto-pst-pdf}
\usepackage[]{pstricks}
\usepackage{mwe}

\begin{document}

\begin{center}
\includegraphics{example-image-a.eps}
\end{center}

\begin{figure}[t]
\begin{pspicture}(0,0)(5,2)
    \psgrid
\end{pspicture}
\end{figure}

\end{document}

The console output in TexWorks that I get after running it is:

This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.7)
entering extended mode
(myscript.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-07-17>
("C:\Program Files\MiKTeX\tex/latex/base\book.cls"
Document Class: book 2019/12/20 v1.4l Standard LaTeX document class
("C:\Program Files\MiKTeX\tex/latex/base\bk10.clo"))
("C:\Program Files\MiKTeX\tex/latex/auto-pst-pdf\auto-pst-pdf.sty"
("C:\Program Files\MiKTeX\tex/generic/iftex\ifpdf.sty"
("C:\Program Files\MiKTeX\tex/generic/iftex\iftex.sty"))
("C:\Program Files\MiKTeX\tex/latex/xkeyval\xkeyval.sty"
("C:\Program Files\MiKTeX\tex/generic/xkeyval\xkeyval.tex"
("C:\Program Files\MiKTeX\tex/generic/xkeyval\xkvutils.tex"
("C:\Program Files\MiKTeX\tex/generic/xkeyval\keyval.tex"))))
("C:\Program Files\MiKTeX\tex/latex/ifplatform\ifplatform.sty"
("C:\Program Files\MiKTeX\tex/latex/tools\shellesc.sty")
("C:\Program Files\MiKTeX\tex/generic/pdftexcmds\pdftexcmds.sty"
("C:\Program Files\MiKTeX\tex/generic/infwarerr\infwarerr.sty")
("C:\Program Files\MiKTeX\tex/generic/ltxcmds\ltxcmds.sty"))
("C:\Program Files\MiKTeX\tex/generic/catchfile\catchfile.sty"
("C:\Program Files\MiKTeX\tex/generic/etexcmds\etexcmds.sty"))
("C:\Program Files\MiKTeX\tex/generic/iftex\ifluatex.sty"))" "
"-------------------------------------------------"
"auto-pst-pdf: Auxiliary LaTeX compilation"
"-------------------------------------------------"
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.7)
entering extended mode
This is dvips(k) 2020.1 Copyright 2020 Radical Eye Software (www.radicaleye.com)
' TeX output 2020.08.04:1253' -> myscript-autopp.ps
<C:/Program Files/MiKTeX/dvips/base/tex.pro>
<C:/Program Files/MiKTeX/dvips/config/alt-rule.pro>
<C:/Program Files/MiKTeX/dvips/pstricks/pstricks.pro>
<C:/Program Files/MiKTeX/dvips/pstricks/pst-algparser.pro>
<C:/Program Files/MiKTeX/dvips/pst-tools/pst-tools.pro>
<C:/Program Files/MiKTeX/dvips/pstricks/pst-dots.pro>
<C:/Program Files/MiKTeX/dvips/l3backend/l3backend-dvips.pro>
<C:/Program Files/MiKTeX/fonts/type1/public/lm/lmss17.pfb>
<C:/Program Files/MiKTeX/dvips/base/special.pro>. [1
<C:/Program Files/MiKTeX/tex/latex/mwe/example-image-a.eps>] [2] 
Error: /undefinedfilename in (-dAutoRotatePages=/None)
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push
Dictionary stack:
   --dict:969/1684(ro)(G)--   --dict:0/20(G)--   --dict:78/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
MiKTeX GPL Ghostscript 9.25: Unrecoverable error, exit code 1
"-------------------------------------------------"
"auto-pst-pdf: End auxiliary LaTeX compilation"
"-------------------------------------------------"


Package auto-pst-pdf Warning: 
    Creation of myscript-autopp.pdf failed.
This warning occured on input line 124.


Package auto-pst-pdf Warning: 
    Could not create myscript-pics.pdf. Auxiliary files not deleted.
This warning occured on input line 124.

("C:\Program Files\MiKTeX\tex/latex/pst-pdf\pst-pdf.sty"
("C:\Program Files\MiKTeX\tex/generic/iftex\ifxetex.sty")
("C:\Program Files\MiKTeX\tex/generic/iftex\ifvtex.sty")
("C:\Program Files\MiKTeX\tex/generic/luatex85\luatex85.sty")
("C:\Program Files\MiKTeX\tex/latex/graphics\graphicx.sty"
("C:\Program Files\MiKTeX\tex/latex/graphics\graphics.sty"
("C:\Program Files\MiKTeX\tex/latex/graphics\trig.sty")
("C:\Program Files\MiKTeX\tex/latex/graphics-cfg\graphics.cfg")
("C:\Program Files\MiKTeX\tex/latex/graphics-def\pdftex.def")))
("C:\Program Files\MiKTeX\tex/latex/pstricks\pstricks.sty"
("C:\Program Files\MiKTeX\tex/latex/xcolor\xcolor.sty"
("C:\Program Files\MiKTeX\tex/latex/graphics-cfg\color.cfg"))
("C:\Program Files\MiKTeX\tex/generic/xkeyval\pst-xkey.tex")
("C:\Program Files\MiKTeX\tex/generic/pstricks\pstricks.tex"
("C:\Program Files\MiKTeX\tex/generic/pstricks\pst-fp.tex"
`pst-fp' v0.05, 2010/01/17 (hv))
("C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfutil-common.tex"
("C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfutil-common-lists.tex"))
("C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfkeys.code.tex"
("C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgfkeysfiltered.code.tex"))
 ("C:\Program Files\MiKTeX\tex/generic/pgf/utilities\pgffor.code.tex"
Loading pgffor.code.tex
("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmath.code.tex"
("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathcalc.code.tex"
("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathutil.code.tex")
("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathparser.code.tex")
("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.code.tex"
("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.basic.code.tex"
)
("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.trigonometric.c
ode.tex")
("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.random.code.tex
")
("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.comparison.code
.tex")
("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.base.code.tex")
("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.round.code.tex"
) ("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.misc.code.tex
")
("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfunctions.integerarithmet
ics.code.tex")))
("C:\Program Files\MiKTeX\tex/generic/pgf/math\pgfmathfloat.code.tex")))
`PSTricks' v2.97  <2019/05/11> (tvz,hv)
("C:\Program Files\MiKTeX\tex/generic/pstricks\pstricks.con"))
("C:\Program Files\MiKTeX\tex/generic/pstricks\pst-fp.tex"))
("C:\Program Files\MiKTeX\tex/latex/preview\preview.sty")
("C:\Program Files\MiKTeX\tex/latex/graphics-def\dvips.def")
("C:\Program Files\MiKTeX\tex/latex/environ\environ.sty"
("C:\Program Files\MiKTeX\tex/latex/trimspaces\trimspaces.sty"))))
("C:\Program Files\MiKTeX\tex/latex/mwe\mwe.sty"
("C:\Program Files\MiKTeX\tex/latex/lipsum\lipsum.sty"
("C:\Program Files\MiKTeX\tex/latex/l3kernel\expl3.sty"
("C:\Program Files\MiKTeX\tex/latex/l3backend\l3backend-pdfmode.def"))
("C:\Program Files\MiKTeX\tex/latex/l3packages/xparse\xparse.sty"
("C:\Program Files\MiKTeX\tex/latex/l3packages/xparse\xparse-generic.tex"))
("C:\Program Files\MiKTeX\tex/latex/lipsum\lipsum.ltd.tex"))
("C:\Program Files\MiKTeX\tex/latex/blindtext\blindtext.sty"
("C:\Program Files\MiKTeX\tex/latex/tools\xspace.sty"))) (myscript.aux)
("C:\Program Files\MiKTeX\tex/context/base/mkii\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
)
Preview: Fontsize 10pt
Preview: PDFoutput 1

LaTeX Warning: File `myscript-pics.pdf' not found on input line 10.


! Package pdftex.def Error: File `myscript-pics.pdf' not found: using draft set
ting.

See the pdftex.def package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.10 \includegraphics{example-image-a.eps}
                                          
? 

I tried the solutions as suggested in the following SX answers:

  1. suparnob10's answer and Werner's answer: Adding \graphicspath{{<first/path>}{<second/path>}...{<last/path>}}
  2. Re-installation of MikTex
  3. Installing perl and ghostscript : Do I need to do anything besides just installing them to make this solution marked as 'tried'? I have currently only installed them.
  4. Adding dvipsnames as an option while importing pstricks led me to another error: ! LaTeX Error: Option clash for package pstricks.. This clash was probably with trimspaces.sty as that was the earlier line.
  5. Loading auto-pst-pdf after pstricks as suggested by the comment by Bernard on the original post

I am running the script using pdflatex with -shell-escape enabled, as that is needed for auto-psd-pdf.

PS: I have included the \begin{figure}\begin{pspicture}..\end{figure} in the MWE just to highlight that the pstricks package is needed in the template.


Update

On removing the pspdf={-dAutoRotatePages=/None} option while loading auto-pst-pdf, as suggested by @Ulrike Fischer a part of the error saying Error: /undefinedfilename in (-dAutoRotatePages=/None) has been replaced with:

Sorry, but pdfcrop did not succeed for the following reason:

  MiKTeX could not find the script engine 'perl.exe' which is required to execute 'pdfcrop'.

Remedy:

  Make sure 'perl.exe' is installed on your system.
The log file hopefully contains the information to get MiKTeX going again:

  C:\Users\aashay\AppData\Local\MiKTeX\miktex\log\pdfcrop.log

However, I do have perl installed on my system: On inputting perl -v in cmd, i get:

This is perl 5, version 30, subversion 2 (v5.30.2) built for MSWin32-x64-multi-thread

The log file pdfcrop.log is as follows:

2020-08-04 15:38:50,326+0200 INFO  pdfcrop - this process (3308) started by 'cmd' with command line: pdfcrop --hires myscript-autopp.pdf myscript-pics.pdf
2020-08-04 15:38:50,340+0200 FATAL pdfcrop.core - The script engine could not be found.
2020-08-04 15:38:50,340+0200 FATAL pdfcrop.core - Data: scriptEngine="perl.exe", scriptName="pdfcrop"
2020-08-04 15:38:50,340+0200 FATAL pdfcrop.core - Source: Libraries\MiKTeX\Core\Session\runperl.cpp:83
2020-08-04 15:38:50,341+0200 FATAL pdfcrop - The script engine could not be found.
2020-08-04 15:38:50,341+0200 FATAL pdfcrop - Info: scriptEngine="perl.exe", scriptName="pdfcrop"
2020-08-04 15:38:50,341+0200 FATAL pdfcrop - Source: Libraries\MiKTeX\Core\Session\runperl.cpp
2020-08-04 15:38:50,341+0200 FATAL pdfcrop - Line: 83
6
  • what do you get if you call where perl.exe on the command line? – Ulrike Fischer Aug 4 '20 at 12:38
  • I get C:\Strawberry\perl\bin\perl.exe, the installation directory of perl. – Aashay Sathe Aug 4 '20 at 12:42
  • are you running miktex from some special setup which could change the path and hide perl? – Ulrike Fischer Aug 4 '20 at 12:49
  • I couldn't understand what you meant by a 'special setup'. But my miktex root directories are C:\Program Files\MiKTeX for Install purposes and C:\ProgramData\MiKTeX for config and data purposes. Additionally the links to MiKTeX executables have been installed in C:\Program Files\MiKTeX\miktex\bin\x64. While miktex installation, I followed the standard procedure by keeping all the settings as default. I hope this helps towards your question – Aashay Sathe Aug 4 '20 at 12:57
  • I've updated the question to contain the log file pdfcrop.log – Aashay Sathe Aug 4 '20 at 13:44
0

On windows the equal sign in the pspdf option is a bit problematic. Try it like this:

\ExplSyntaxOn
\newcommand\hashchar{}
\edef\hashchar{\c_hash_str}
\ExplSyntaxOff
%use \hashchar instead of =:
\usepackage[pspdf={-dAutoRotatePages\hashchar/None},pdfcrop={ --hires}]{auto-pst-pdf}

(or remove the pspdf option, perhaps you don't need it ...)

3
  • I tried removing the pspdf option and also tried replacing equal sign with \hashchar as defined by you. Nonetheless, the error persisted. – Aashay Sathe Aug 4 '20 at 12:11
  • 1
    I can't really believe that you get the error Error: /undefinedfilename in (-dAutoRotatePages=/None) if you don't use the option. – Ulrike Fischer Aug 4 '20 at 12:17
  • Yes. Sorry, You are correct. This part of the error has now been replaced with another error saying that MiKTeX could not find the script engine 'perl.exe' which is required to execute 'pdfcrop'. However perl is installed on my system as I do get the version i perform perl -v. I'll updated the original post with this too. – Aashay Sathe Aug 4 '20 at 12:27
0

The solution, in my case was threefold:

  1. As suggested by @Ulrike Fischer, i removed the pspdf/ edited it by replacing the equal sign. (For this point, I have accepted that answer for this question.)
  2. (and 2.5.) I read that some people were experiencing problems when the pdfcrop was was installed before perl was installed. Additionally, I had installed strawberry perl earlier. I uninstalled strawberry perl and installed active perl (Though I do not know why that should affect it. Hence I have am confused whether it was twofold/ threefold :P).
  3. Then I manually reinstalled pdfcrop from MiKTeX console.

After doing this, the I was able to run the MWE (and by induction, my main thesis files too) successfully.

0

For windows:

\usepackage[pspdf={-dAutoRotatePages\#/None},pdfcrop={ --hires}]{auto-pst-pdf}
1
  • It is a complete and valid line of code! – user187802 Aug 6 '20 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.