# [texworks] graphics problem

Bruno Voisin bvoisin at me.com
Wed Feb 24 14:32:04 CET 2010

Le 24 févr. 2010 à 13:43, Benny Lautrup a écrit :

> I have now tried to output eps-files from Mathematica, and convert them on
> the fly with epstopdf. The problem persists with TeXworks, and not all files
> are embedded in the pdf-file.
>
> I do not have Ghostscript installed, so perhaps that is the problem?

Yes, that is certainly the problem. Ghostscript is an absolute requirement. Beware that the epstopdf LaTeX package is something different from the epstopdf executable:

- The latter is a Perl script epstopdf.pl (at least on the Mac and on Linux) calling Ghostscript with the appropriate options to perform EPS-to-PDF conversion <http://tug.org/epstopdf/>. This is typically a tool operated from the command line.

- The former is a LaTeX package epstopdf.sty calling graphics conversion tools on-the-fly when pdfLaTeX is attempting to include a graphical file in a format that pdfLaTeX doesn't know about (ie, other than PDF, PNG and JPEG). It typically calls the script epstopdf.pl to perform the conversion from EPS to PDF, but it can be told to use other scripts and to convert from other formats.

Now, epspdf is yet another script, namely a Ruby script epspdf.rb, also relying on Ghostscript but able to use xpdf instead and having different options from epstopdf.pl and having also a graphical interface epspdftk.rb.

You can tell the package epstopdf.sty to use epspdf.rb instead of epstopdf.pl by writing in the preamble of your LaTeX file

\epstopdfDeclareGraphicsRule{.eps}{pdf}{.pdf}{%
epspdf #1 \OutputFile
}

and you can also use it for other conversions. For example, you may remember that I tested it recently in another thread on this list for on-the-fly BMP-to-PNG conversion using either the tools convert, sam2p or sips, as follows

\AppendGraphicsExtensions{.bmp}
\epstopdfDeclareGraphicsRule{.bmp}{png}{.png}{%
convert #1 \OutputFile
}
% or
\epstopdfDeclareGraphicsRule{.bmp}{png}{.png}{%
sam2p #1 \OutputFile
}
% or
\epstopdfDeclareGraphicsRule{.bmp}{png}{.png}{%
sips --setProperty format png #1 --out \OutputFile
}

But that is not the immediate issue here. What's needed is first to install Ghostscript, and then see whether epstopdf.pl (the script) is included in MikTeX. On Linux or Mac you would use which and ls for this:

\$ which epstopdf
/usr/texbin/epstopdf
\$ ls -l /usr/texbin/epstopdf
lrwxr-xr-x  1 root  wheel  45 13 jan 23:17 /usr/texbin/epstopdf -> ../../texmf-dist/scripts/epstopdf/epstopdf.pl

which tell that the executable epstopdf is a symbolic link to the Perl script epstopdf.pl inside the TeX Live directories.

If epstopdf isn't part of MikTeX, or can't be installed with the MikTeX Package Manager, then you should turn to epspdf and follow the detailed installation instructions (I mean, really detailed) for Windows and MikTeX at <http://tex.aanhet.net/epspdf/>.

Before embarking into that, you may first try the test that I described in my last message, allowing to see whether the PDF file that I produced with Mathematica exhibits the same problem as yours, and whether the PDF files that I produced by applying the scripts epstopdf.pl and epspdf.rb to Mathematica's EPS output solve the problem.

I'll have to stop following this thread today owing to lack of time, sorry.

Bruno