[Tex/LaTex] Unwanted white space when compiling to pdf from eps

epstopdfmarginspdftex

A journal requires submission of figures in .eps format, so I need to be able to compile using an eps image "on the fly". Here is a MWE which uses an eps graphics file:

\documentclass{article}
\usepackage{graphicx}
\begin{document}
  \begin{figure}[t]
    \centering
    \caption{too much white space!}
    \includegraphics[scale=0.4]{fdr80}
  \end{figure}
\end{document}

The eps image has minimal margins (by fixing its BoundingBox), but the converted pdf image has too much white space on top (I think latex does the conversion automatically, I don't call epstopdf but I can see it being used in the log). How do I get rid of the white space? I've already tried the answer at Using pdfcrop within epstopdf? and it doesn't work: I get an error saying that it can't find the pdf file. (so epstopdf called by pdflatex is probably failing there).

EDIT: Some more information is in order. I produced the eps figure using R. More importantly, I used the R package "extrafont" to embed a Computer Modern font into the eps. I believe this embedding is causing the problem. I just tried to use a simple eps (no embedding of fonts) and tex converts it to a pdf with the correct borders, no additional white space on top.

Best Answer

Upon inspecting the eps file (in a text editor), I saw that there were two lines starting with %%HiResBoundingBox. Deleting the wrong one fixed the problem.