6
\documentclass{minimal}
\usepackage[pdf]{pstricks}

\begin{document}

\begin{pspicture}(-5.25,-5.25)(5.25,5.25)%
  \pscircle*[linecolor=cyan]{5}
  \psgrid[subgriddiv=0,gridcolor=lightgray,gridlabels=0pt]
  \Huge\sffamily\bfseries
  \rput(-4.5,4.5){A} \rput(4.5,4.5){B}
  \rput(-4.5,-4.5){C}\rput(4.5,-4.5){D}
  \rput(0,0){auto-pst-pdf}
  \rmfamily
  \rput(0,-3.8){PSTricks}
  \rput(0,3.8){\LaTeX}
\end{pspicture}

\end{document}

I run it with:

pdflatex -shell-escape Test.tex > log.txt 2>&1

But stdout says:

PDFCROP 1.33, 2012/02/01 - Copyright (c) 2002-2012 by Heiko Oberdiek.
!!! Error: Ghostscript exited with error code 1!

The same happens when using \usepackage{pstricks} \usepackage{auto-pst-pdf}.

If I use \usepackage{pstricks} \usepackage[crop=off]{auto-pst-pdf} then it works!

I use Windows 7 x64, MikTeX 2.9 x86 (complete system) with latest packages, installed latest ActivePerl x86 and also applied the pdfcrop fix (as the related problem appeared earlier).

You see all details in the logs for stdout, Test.log, and Test-autopp.log.

Any ideas?

UPDATE: I tried to manually run pdfcrop and got the same error. When I run it with --debug I see that it can't locate the Ghostscript executable gswin32c.exe. I looked into the MikTeX bin/ folder because I thought it is there, but it isn't. Do I have to install Ghostscript separately?

letmaik
  • 1,947

2 Answers2

0

I made some test with miktex 2.9.: auto-pst-pdf with pdfcrop works for me only if an external perl is in the path. An external ghostscript is not necessary. This here is the "minimal working path" (I guess the windows path is needed for cmd.exe):

Path=J:\MiKTeX2.9\miktex\bin;C:\WINDOWS\system32;J:\Perl\bin;
Ulrike Fischer
  • 327,261
  • I already have Perl in my PATH, this was done automatically when installing ActivePerl. – letmaik Sep 08 '12 at 15:16
  • @neo: And what else have you in your path? Is there another ghostscript? Does it work if you restrict the path to the entries I mentioned? – Ulrike Fischer Sep 09 '12 at 16:58
  • There's no other ghostscript in my path. I don't think it's a path problem anyway because the error says it exited with error code 1 which means that it actually run ghostscript. I will delete this question soon as it seems I get away with crop=off for my specific cases (using pstree). – letmaik Sep 09 '12 at 18:54
  • Forget that. See my update! We're getting closer.. – letmaik Sep 09 '12 at 19:15
0

I really don't know why, but I had to separately install Ghostscript so that pdfcrop could use gswin32c.exe. I thought it was included (shouldn't it?) in MikTeX.

Another note: Although my minimal example is working now, I couldn't get it working for bigger documents. I figured out that there seems to be some (unwanted?) difference between

\usepackage{pstricks,auto-pst-pdf}

and

\usepackage[pdf]{pstricks}

Only the first worked! For the second one I got strange Ghostscript errors:

Error: /typecheck in --div--
Operand stack:
   1   0   0.0   -0.0367123   a   65781.8
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1926   1   3   %oparray_pop   1925   1   3   %oparray_pop   1909   1   3   %oparray_pop   1803   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   --nostringval--   4   --nostringval--   %repeat_continue   --nostringval--
Dictionary stack:
   --dict:1169/1684(ro)(G)--   --dict:0/20(G)--   --dict:122/200(L)--   --dict:104/300(L)--
Current allocation mode is local
Current file position is 167839
letmaik
  • 1,947
  • You should ask your problem with \usepackage[pdf]{pstricks} vs. \usepackage[pdf]{pstricks} as a separate question, so it could potentially be seen by more people with a clue to answer. – Speravir Sep 09 '12 at 20:55
  • write \listfiles into your preamble and then show the file list which is at the end of the log file. –  Sep 10 '12 at 05:48
  • @Herbert: Here you go: http://pastie.org/4694273 – letmaik Sep 10 '12 at 07:44
  • @neo: please create a minimal example with the article class which shows the problem. Then it is easier to see what's going wrong. –  Sep 10 '12 at 08:17
  • @Herbert: Alright, as Speravir already suggested I will create a new question for that issue when I got some time. I'll link it from here then. – letmaik Sep 10 '12 at 08:19
  • @neo: ok. you can also try to run the document without using auto-pst-pdf but running it with xelatex –  Sep 10 '12 at 08:46
  • Created a new question with minimal example, seems to be a problem with beamer. – letmaik Sep 11 '12 at 19:20