Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error including image in Latex [closed]

Tags:

pdf

latex

eps

I am getting the following error while compiling my Latex File :

! LaTeX Error: Cannot determine size of graphic in tree.jpg (no BoundingBox).

Why do I get this error ? What has this to do with an .eps file ?

In fact, I could compile it fine with MacTex on my machine. But when I submit it online to a scientific journal for publication, it compiles it on the server and sends me the resultant PDF which has all these errors that prevent it from compiling.

I am using the following syntax for including the images :

\begin{figure}[!h]     \begin{center}         \scalebox{0.45}{             \includegraphics{tree.jpg}}     \end{center}             \caption{\small A sample}             \label{tree} \end{figure} 

What should I do ? Could it be that their server is using an old compiler ?

UPDATE : It finally worked. I converted the first image to PDF and the compilation happened perfectly. I guess it used the bounding box value from that PDF and applied it to all images.

like image 809
euphoria83 Avatar asked Apr 08 '09 21:04

euphoria83


People also ask

Why is my image not loading in LaTeX?

If the images are still not appearing, there is likely something wrong in your LaTeX. Make sure that you have uploaded the file and specified the file location correctly.

How do you fix an image position in LaTeX?

You can control the position of an image using options for the figure environment, e.g. the [h!] in the example below tells LaTeX to put the figure exactly where it appears in the text, instead of letting it 'float' to a particular place in the document.

Can you include JPG in LaTeX?

For inclusion of JPG images, you cannot use the latex compiler. You need to use pdflatex. See Which graphics formats can be included in documents processed by latex or pdflatex? Welcome to TeX.

Can you insert images in LaTeX?

Including images in your LaTeX document requires adding: \usepackage{graphicx} to the beginning/preamble of your document. \includegraphics{ } command tells LaTeX to insert the image. To upload an image, click the upload button, and upload your image file.


2 Answers

To include png and jpg, you need to specify the Bounding Box explicitly.

\includegraphics[bb=0 0 1280 960]{images/some_image.png} 

Where 1280 and 960 are respectively width and height.

like image 183
h3xStream Avatar answered Sep 23 '22 12:09

h3xStream


I've had the same problems including jpegs in LaTeX. The engine isn't really built to gather all the necessary size and scale information from JPGs. It is often better to take the JPEG and convert it into a PDF (on a mac) or EPS (on a PC). GraphicsConvertor on a mac will do that for you easily. Whereas a PDF includes DPI and size, a JPEG has only a size in terms of pixels.

( I know this is not the answer you wanted, but it's probably better to give them EPS/PDF that they can use than to worry about what happens when they try to scale your JPG).

like image 24
Uri Avatar answered Sep 21 '22 12:09

Uri