include figure files in latex [closed]
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this questionI 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 th开发者_运维问答e latter, things become reverse?
Is it possiblt to include figure files of both eps and jpg in the same latex file?
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}
You have to add the package option pdftex
to the package graphicx
:
\usepackage[pdftex]{graphicx}
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
精彩评论