Certain EPS files don't convert with epstopdf
GUI
As Bernard pointed out, the epspdf-extra bundle is one possible choice. All you need to do is download epspdf-extra.zip and use the Windows installer provided to install epspdf
with a buit-in Tcl/Tk runtime, which can be used as a GUI application (illustrated on page 3 of the user manual to the epspdf
package).
command line
Alternatively you can download epspdf.0.6.0.zip from tex.aanhet.net/epspdf, and follow these instructions:
- Extract all files into a folder
<path to>\epspdf
(e.g.C:\Program Files\epspdf
). In
<path to>\epspdf
create an empty text file with the nameepspdf.bat
. Then copy the following lines into the batchfile and adjust the script path to your settings:@echo off set ScriptPath=<path to>\epspdf texlua %ScriptPath%\epspdf.tlu %*
where
<path to>
could be, for example,C:\Programs
or"C:\Program Files"
(the quotes" "
are included).Add
<path>\epspdf
to the system variablePath
(Start Menu > right-click on Computer > Properties > Advanced System Settings > Environment Variables under the Advanced tab > look for the system variablePath
and edit its value).
This approach allows you to use epspdf
from the command line in combination with the \write18
feature (add --enable-write18
, or the alias --shell-escape
, to the list of arguments passed to the pdflatex compiler). With regard to the problematic EPS file, here's a MWE:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\immediate\write18{epspdf prob1_pdfa.eps}
\includegraphics[keepaspectratio=true,width=0.9\textwidth]{prob1_pdfa.pdf}
\end{document}
A somewhat more creative approach based on LaTeX code found on page 3 of this document is to define a command \includeeps
with a mandatory argument that accepts the name of the EPS file (without the .eps
extension) you wish to include in your document, and an optional argument that can pass options to the \includegraphics
command:
\newcommand{\executeiffilenewer}[3]{%
\ifnum\pdfstrcmp%
{\pdffilemoddate{#1}}%
{\pdffilemoddate{#2}}%
>0%
{\immediate\write18{#3}}%
\fi%
}
\newcommand{\includeeps}[2][]{%
\IfFileExists{./#2.pdf}%
{\executeiffilenewer{#2.eps}{#2.pdf}{epspdf #2.eps}}%
{\immediate\write18{epspdf #2.eps}}%
\includegraphics[#1]{#2.pdf}
}
When a file is included via \inclueeps
, the epspdf
program is only called when no .pdf
file exists, or the EPS file has been updated.
Examples of usage with file abc.eps
as input:
\includeeps[width=6cm]{abc}
\includeeps{figures/abc}
\includeeps{../section/abc}
\includeeps[keepaspectratio=false,height=9cm]{../section/abc}