views:

514

answers:

3

Hi,

I am trying to include jpeg files in latex

\includegraphics[width=57.6mm, height=43.2mm]{../../results2/html/zerooneloss_stumps.jpg}  

With specified the width and height and compiled with pdflatex, however, it produces the error:

! LaTeX Error: Cannot determine size of graphic in ../../results2/html/zerooneloss_stumps.jpg (no BoundingBox).  

The true size of the image is 576x432 in pixels. Have I specified the size correctly in the latex file?

Anyway to use the default setting without need to specify the width and height? If I don't specify the them in the latex file,

\includegraphics[]{../../results2/html/zerooneloss_stumps.jpg}

I still get the same no BoundingBox error.

Thanks and regards!


Change

\includegraphics[]{../../results2/html/zerooneloss_stumps.jpg}

to

\includegraphics{../../results2/html/zerooneloss_stumps.jpg}

still has the no BoundingBox error.


I am using

\usepackage[dvips]{graphicx}

What is the difference between it and

\usepackage{graphicx}

It seems with the former one, eps figure files can work while jpeg files cannot, with the latter, things become reverse?


Is it possiblt to include figure files of both eps and jpg in the same latex file?

+1  A: 

try \includegraphics{myfig.jpg}

when you say [width=57.6mm, height=43.2mm] it's the box size in millimeters (mm). latex scales your image to this dimension.

more scale options: http://amath.colorado.edu/documentation/LaTeX/reference/figures.html

For the no Bounding Box error:

What's a BoundingBox?

A BoundingBox is a entry that is located in PostScript files that tells the reader the scale limits of the file. Latex uses this entry to determine how to place the image in the document. How to fix my Latex problem

It is quite easy to fix this problem. The software package ImageMagick is used in this case to convert the images from one form to another. ImageMagick is able to convert many image formats to many other types. To do the conversion just enter this into your console:

root@Pingu ~ # convert image.jpg image.eps

http://www.tuxpages.com/helppages/latex-convert.shtml

darlinton
But he is using pdflatex, so conversion to pdf instead of eps should be better
Gacek
+2  A: 

Do you have \usepackage{graphicx} in your preamble?

EDIT (consequent of an edit in the question): you should not use the dvips option when using pdflatex. The option produces informations useful for the postprocessing of the dvi output of the latex program (e.g. via dvips). In you case, since you are using pdflatex you should simply not give any option to the graphicx package (the right driver is choosen automatically). On the other hand pdflatex only supports external graphics in PNG, JPG or PDF format, but, as other have said, it's easy to convert EPS to PDF: my preferred way is to use epstopdf that in Ubuntu is provided by the texlive-extra-utils package.

For example, when processed with pdflatex, the following example works if you have a file image.png or image.jpg or image.pdf in the current directory:

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{image}
\end{document}
baol
Thanks! I am using \usepackage[dvips]{graphicx}. What is the difference?
Tim
If you are using pdflatex the dvips option is not compatible (it's useful for latex output). Also when using pdflatex you should include only jpegs, pngs and pdf images. I believe the default driver depends on the executable you use to "compile" it.
baol
+2  A: 

You have to add the package option pdftex to the package graphicx:

\usepackage[pdftex]{graphicx}
mrucci
Thanks! What is its difference with \usepackage[dvips]{graphicx} and \usepackage{graphicx}?
Tim
Usually there is no difference because `dvips` is the default driver.
mrucci