6

After profiting enormously from other people's questions here, I finally need to ask one myself: since I updated my MiKTeX 2.9 installation a week ago, I can't compile my PhD thesis anymore.

I use pdflatex in conjunction with the auto-pst-pdf package to include graphics obtained with matlabfrag. I also need TikZ for a couple of diagrams and custom chapter and section headings that I programed using the features of the memoir class.

In this configuration, Ghostscript 9.05 (the one included in MiKTeX 2.9) crashes with an irrecoverable error. Here's a minimal example to reproduce the problem:

\documentclass{article}

% (A) alternatively, comment the following two lines
\usepackage{tikz}
\usetikzlibrary{arrows}

\usepackage{psfrag}
\usepackage{auto-pst-pdf}

\begin{document}

% (B) or those two lines in order to prevent the Ghostscript error
\begin{center}
\end{center}

\input{brachistochroneA1.tex}
\includegraphics[width=\textwidth]{brachistochroneA1}

\end{document}

The weird thing is that Ghostscript doesn't break if either the TikZ import or the \begin{center} and \end{center} block is commented out. (I expect that this also holds for other blocks, but I haven't tested it yet.)

I'd greatly appreciate any help!

Also, as an alternative, I tried pstool (since the auto-pst-pdf manual suggests its use as replacement), but this gives me different trouble: the \includegraphics{...} directive takes subdirectories (as usual) with a forward slash /, but since I'm on Windows, these need to be translated into backslashes \ for shell-escape commands. Unfortunately, pstool seems not to be doing this, resulting in command line errors when copying the bbl file. (Should I ask this in a separate question?)

  • 1
    Try \usepackage{ifpdf}\ifpdf\usepackage{tikz}\fi. – Ulrike Fischer Mar 20 '14 at 10:05
  • Sorry -- that was rather obvious, wasn't it? (Add the sound of someone frenetically slapping himself.) Many thanks, Ulrike! How do I mark this as an answer? – Andreas Häusler Mar 20 '14 at 10:15
6

Try

   \usepackage{ifpdf}
    \ifpdf
      \usepackage{tikz}
    \fi

Remark: Why the new pgf version breaks in auto-pst-pdf hasn't been analysed yet. So this is more a work-around then a solution.

  • 2
    it prevents the loading of the PostScript files. I suppose a problem with a redefinition of the \special command. – user2478 Mar 20 '14 at 10:54
  • 1
    Thanks for the background information! After 30 hours of trying to isolate the error out of a multitude of package imports and customizations, and a heads-over-heels dive into auto-pst-pdf.dtx trying to execute it step-wise in the shell, I'm relieved that my thesis compiles again -- even more though that I now know that it didn't fail because I unknowingly used some deprecated functions. :-) – Andreas Häusler Mar 20 '14 at 11:21
  • 1
    @AndreasHäusler: Well, I've been fighting with this for several days and I was about to ask a question right before I saw your OP. It took me a long time to figure out something was not quite right with the latest tikz. – Marcos Apr 7 '14 at 8:08
  • 1
    @AndreasHäusler: I have been struggling through those packages for days as well... Seems the problem still exists... Took some time to find the right solution as well, but this works as a charm. – long tom Aug 26 '16 at 9:41
  • I too have been helped by this, after many hours trimming down my thesis to identify the error and/or in preparation for posting an MWE to tex.SX! – owjburnham Sep 11 '18 at 14:05

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.