1

I am trying to use psfrag to alter axes labels of plots from Mathematica. Unfortunately eps files are not supported by pdflatex, so they are converted using epstopdf. To get the epstopdf working, I altered the initialisation file of pdflatex to enable write18 following the instructions of this post, it works fine now.

Now to get psfrag working together with epstopdf, I included auto-pst-pdf. So my includes look like:

\usepackage{graphicx, psfrag}
\usepackage[outdir=./]{epstopdf}
\usepackage{auto-pst-pdf}

My Latex file compiles without any errors, the log files are empty. But maybe I should mention that I use \graphicspath{{img/}} to alter the standard graphics path.

The Latex code I use to include my figures goes something like this:

\begin{figure}
    \psfrag{xlabel}{Frequency}
    \psfrag{ylabel}{Acceleration}
    \includegraphics{somefigure.eps}
\end{figure}

I am using MikTeX and edit the files with TeXworks. What am I doing wrong?

EDIT: I didn't know that I wasn't providing enough information about my problem, so here is the test file I set up, along with the test eps file:

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{psfrag}
%\usepackage{auto-pst-pdf}

\begin{document}

\begin{figure}
    \psfrag{xlabel}{Frequency ($Hz$)}
    \psfrag{ylabel}{Acceleration ($\frac{m}{s^2}$)}
    \includegraphics{testfigure.eps} 
\caption{Test}
\end{figure}

\end{document}

Here is the Google Drive Link to my eps file.

All files are in the same directory, I don't get any errors or warnings.

EDIT2: Like Ulrike Fischer suggested, I now ran the test document with pdflatex and included auto-pst-pdf this time. Here are the results:

The only errors in the log files I found were these from TeXworks itself (in the logfile with the name "texworks", all other log files were either empty or had old logs in it.):

2017-03-27 14:08:04,220+0200 INFO  texworks - starting: MiKTeX TeXworks 0.6.1 (MiKTeX 2.9.6210 64-bit)
2017-03-27 14:08:04,220+0200 INFO  texworks -   argument(s): C:\Users\########\Google Drive\Uni\Grenoble\Bachelorarbeit\LIVE\test.tex

The errors I get in TeXworks are:

pdflatex+auto-pst-pdf produces these errors

So there is obviously something wrong with epstopdf, but why?

EDIT3: Ulrike Fischer suggested copying the test file to a local folder (or a folder not watched by Google Drive) and trying running pdflatex --shell-escape test in a shell. Now I get proper help from the errors thrown:

Package pst-pdf Warning: File `test-pics.pdf' not found.
(pst-pdf)                Use the following commands to create it:
(pst-pdf)                ----------------------------------------------------
(pst-pdf)                latex test.tex
(pst-pdf)                dvips -o test-pics.ps test.dvi
(pst-pdf)                ps2pdf test-pics.ps
(pst-pdf)                ----------------------------------------------------

Using first latex and then dvips followed by converting the post script file into a pdf works. I can write a script that automates this, but isn't there a more easy fix? And I don't know enough about LaTeX to know that this won't mess with any of my packages I now use?

  • there are several ways psfrag can fail first try just using latex+dvips instead of pdflatex (actually if that works you are done as you can save the result as pdf and include it into the pdflatex document) (although I don't think you should load the epstopdf package explictly, let auto-pst-pdf handle it) – David Carlisle Mar 25 '17 at 21:25
  • So I have to install a new Latex editor/shell for that purpose? If I don't load the epstopdf explicitly, then I get an error when setting the image path... – NE555 Mar 25 '17 at 21:40
  • no, miktex includes latex and pdflatex you don't need to install anything you haven't got already also start from the simplest configuration, the image in the same folder as the document so no graphics path and no specified output directory – David Carlisle Mar 25 '17 at 21:46
  • Why do you complicate your setup by using a graphicspath and a output-dir and auto-pst-pdf? Try first a simple example and when this works you can think about refinements. Beside this: when you get errors you should tell the error message. – Ulrike Fischer Mar 25 '17 at 22:05
  • Ok I set up a test document, but now things get weird: I am compiling just with pdflatex, and with all the same inlcudes and the same code, now I get the problem that write18 isn't enabled (which is enabled in the ini file). So I added a shell option to the compiler settings in TeXworks, to both the pdfLatex+MakeIndex+BibTeX compiler and the pdfLatex compiler. The original file compiles as usual without errors, the pdfLaTeX compiler says that the shell option isn't recognized?! – NE555 Mar 25 '17 at 22:11

Your Answer

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

Browse other questions tagged or ask your own question.