Graphics, Figures & TablesBounding Box Issues with EPS File

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
nancyh
Posts: 7
Joined: Tue Mar 05, 2013 2:30 pm

Bounding Box Issues with EPS File

Post by nancyh »

I have created an EPS image of a plot produced in Python and used it in my code as below.

Code: Select all

\begin{figure}
  \centering
  \begin{subfigure}[b]{0.3\textwidth}
    \centering
    \includegraphics[width=\textwidth,height=\textheight,keepaspectratio]{r2_pdf_22.eps}
    \caption{Probability density function for r2}
    \label{fig:pdfr2}
  \end{subfigure}
\end{figure}
(There is more, but it just repeats for each sub-figure and ends.)

I am getting this error message.

Code: Select all

! LaTeX Error: Cannot determine size of graphic in
r2_pdf_22.eps (no BoundingBox).

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.274 ...extheight,keepaspectratio]{r2_pdf_22.eps}
I have tried to search about this, but most people seem to have the error when trying to use JPG, not EPS. I think I need to change the EPS itself, but I can't work out how to do this. I've seen some mention of Ghostscript, but being new to all this I'm not sure how to use it or what to do next.

Can anyone help?

Thanks
Last edited by localghost on Wed Mar 20, 2013 4:44 pm, edited 2 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Bounding Box Issues with EPS File

Post by Stefan Kottwitz »

You need to compile with LaTeX in DVI mode, i.e. not directly to PDF via pdfLaTeX.

Or, use epstopdf - newer versions of TeX Live could do it automatically for you.

Code: Select all

\usepackage{epstopdf}
Stefan
LaTeX.org admin
nancyh
Posts: 7
Joined: Tue Mar 05, 2013 2:30 pm

Re: Bounding Box Issues with EPS File

Post by nancyh »

I am compiling in DVI mode. I turn it into a PDF later.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: Bounding Box Issues with EPS File

Post by Stefan Kottwitz »

Perhaps post the EPS file here, as attachment, for us to check if it's correct EPS.

Stefan
LaTeX.org admin
Post Reply