views:

5941

answers:

3

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 ?

Infact, 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 as all these error 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.

+6  A: 

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).

Uri
Thanks. Great help. But then why is it working on my machine ? How is it getting the bounding box values ?
euphoria83
MacTex seems to be more robust than other Tex distributions that I've seen. After working with too many academic publishers I've realized that I can never find something as old and incompatible as whatever they're using, so I just create EPS or PDFs.
Uri
By the way, if you draw diagrams take a look at OmniGraffle. One of the best reasons to use a Mac
Uri
Yeah, its surprising how the interface for CS journals are so out-dated. How do I convert to PDF format ? Is GraphicsConvertor a software provided with the OS ? I could not find it here and on the internet.
euphoria83
@euphoria: Which journal are you publishing to? A lot of the ACM journals and conferences actually take word files, which is even worse.
Uri
Even this journal takes word. I guess that why they don't care much about having an up-to-date latex engine on the server. But still, what's GraphicsConvertor? Is that a software ?
euphoria83
Yea, it's a really good conversion software for the mac. Costs a lot, but you could use the demo for a while. http://www.lemkesoft.com/I use it for all my screenshot and conversion needs.
Uri
Hey Uri. It worked. Thanx very much. :-)
euphoria83
Enjoy. Congratulations on the paper ! I've only done conferences so far.
Uri
you work on really cool stuff. API documentation is always a big pain. I applied to CMU too. But Luis Von Ahn couldn't help me get in. I had worked on CAPTCHA before.
euphoria83
@euphoria83: I think Luis has got his hands full with so many students and people working for him. And this year CMU's been feeling the crunch so the number of students it can support has been lower.
Uri
IT was a fun topic (took me a while to get to it), it's a pity I'll never follow up on it ever again as I'm going to the industry. I hope I can at least get people to use my eMoose tool.
Uri
A: 

I use MacTex, and my editor is TexShop. It probably has to do with what compiler you are using. When I use pdftex, the command:

\includegraphics[height=60mm, width=100mm]{number2.png}

works fine, but when I use "Tex and Ghostscript", I get the same error as you, about not being able to get the size information. Use pdftex.

Incidentally, you can change this in TexShop from the "Typeset" menu.

Hope this helps.

Tom
yeah. but i can't change the engine on the server. ;-)
euphoria83
Yea, I had the same problem when I tried using this. I eventually just decided to let the file contain everything.
Uri
+1  A: 

If you have Gimp, I saw that exporting the image in .eps format works.

balaur