[Tex/LaTex] EPS Figure is cutoff on right when built to pdf, .eps is fine

epslyx

I have to make an .eps file from a large png for publication in PRL. When viewing the .eps in ghostscript/inkscape/illustrator/… it looks fine, but when I build it into a pdf using latex -> DVI -> PDF in TexnicCenter/TexMaker its got a big white block covering the right side.

I generated the latex using LyX export, and have been trying to get it to compile as well as it did in LyX. The figures look perfect when compiled with pdflatex in LyX, so there must be something different with my build profile that's obscuring my figures? Any tips?

EDIT: The minimal example below produces a 'file not found' for the graphic file using pdfLaTeX, and compiles with the figure cutoff on the right when compiled with latex -> DVI -> PDF. Some of my other .eps figures display perfectly when placed in that float, while others don't show at all. However, the .eps all look fine when viewed on their own, and appear to have good bounding boxes in ghostview.

\documentclass{paper}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{float}
\usepackage{amsmath}
\usepackage{graphicx}
\makeatletter
\makeatother
\usepackage{babel}
\begin{document}
\title{Blah}
\author{Bleh}
\begin{abstract}
Abstract goes here.
\end{abstract}
\maketitle
\begin{figure*}[t!]
\begin{centering}
\includegraphics[width=0.75\textwidth]{phasediagramstogether2}
\end{centering}
\caption{This figure is cutoff on the right, with a big white box}%
\label{RDFsandSamples}
\end{figure*}
\end{document}

The error log generated using pdfLaTeX: http://pastebin.com/MRGtUsQJ

The error log for latex -> DVI -> PDF: http://pastebin.com/QA4tVuzY

Best Answer

pdflatex cannot handle EPS files directly, and you'll note from the log file that .eps is not among the filetypes it considers:

l.38 ...hics[width=0.75\textwidth]{paperfractalds}

I could not locate the file with any of these extensions:
.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPEG,.JBIG2,.JB2

Therefore, the file has to be converted to a different format, normally PDF. The package epstopdf does this for you, so adding

\usepackage{epstopdf}

to the preamble and compiling with shell-escape enabled (see e.g. How to enable shell-escape in TeXworks?) should take care of that. You may need to use the flag --enable-write18 instead of --shell-escape (they do the same thing, but the former is used by MikTeX).

Note that with newer versions of TeX Live at least, this conversion is handled automatically, so there is no need to add that package or enable shell-escape. I do not know if the same is the case for MikTeX 2.9.

I think LyX perhaps handles these conversions itself, hence not needing that package, but I may be completely wrong. Asking a question at the lyx-users mailing list is probably the best way to figure that out. Also, I though EPS files would work fine when compiling via DVI, so why that doesn't work I don't know.

The log also shows an error from babel, which can occur for example if you compile once, then remove a language option from \documentclass or babel and compile again (see https://tex.stackexchange.com/a/82673/586). \usepackage[english]{babel} should fix that part I guess.