Graphics, Figures & TablesInclude Graphics not Working

Information and discussion about graphics, figures & tables in LaTeX documents.
jrichey
Posts: 6
Joined: Tue Sep 15, 2009 10:43 pm

Include Graphics not Working

Post by jrichey »

I am trying to use \includegraphics to, well, include a graphic in the document- however, when I run it I get the following error:

I could not locate the file with any of these extensions:
.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPEG,.JBIG2,.JB2

The name of the file it's saying it can't locate has no spaces in it. Here's the code:

Code: Select all

\documentclass[paper,9.5pt]{article} 
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage[usenames,dvipsnames]{color}
\begin{document}

\title{*Title*}
\date{}
\author{}
\maketitle
\doublespace

\includegraphics{image1}

*Stuff*

\end{document}
The file "image1" is a .png file that I pasted into Paint and saved as a .png.

I'm on a PC, running pdfLaTeX in TeXworks.

Is there something else I need to include? What am I missing?

Recommended reading 2024:

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

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

meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Re: Include Graphics not Working

Post by meho_r »

I tested your code with a .png image and no problems occur. You did put that PNG image at the same location as your .tex file, didn't you?
jrichey
Posts: 6
Joined: Tue Sep 15, 2009 10:43 pm

Re: Include Graphics not Working

Post by jrichey »

Both files are in the same folder, yes.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: Include Graphics not Working

Post by Stefan Kottwitz »

You could post your .log file as attachment here, perhaps we would find the cause inside it.

Stefan
LaTeX.org admin
jrichey
Posts: 6
Joined: Tue Sep 15, 2009 10:43 pm

Re: Include Graphics not Working

Post by jrichey »

Here's the whole log file.

Thanks a lot!
Attachments
Ars Magna Full Issue 1.log
(4.23 KiB) Downloaded 542 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Include Graphics not Working

Post by Stefan Kottwitz »

jrichey wrote: LaTeX Warning: Unused global option(s):
[paper,9.5pt].
This has nothing to do with the error, but use a supported paper size and a supported font size instead, for instance a4paper, 10pt or 11pt.

I cannot find a reason at first sight. Perhaps try

Code: Select all

\includegraphics{image1.png}
and ensure that the filename is really correct, not Image1.png for instance.

Stefan
jrichey
Posts: 6
Joined: Tue Sep 15, 2009 10:43 pm

Re: Include Graphics not Working

Post by jrichey »

Tried adding the .png- same error. And don't worry, I've checked that the file name is right at least a thousand times by now.

I've also tried adding \DeclareGraphicsExtentions{.png}, but that didn't help. (In fact, it didn't even recognize the function.)

I noticed that LaTeX listed .png and .PNG as two different file types- image1 is .PNG; could that pose a problem? What is the difference between the two?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Include Graphics not Working

Post by Stefan Kottwitz »

jrichey wrote: I've also tried adding \DeclareGraphicsExtentions{.png}, but that didn't help. (In fact, it didn't even recognize the function.)
The macro name is not correct, it's called \DeclareGraphicsExtensions.
jrichey wrote:
I noticed that LaTeX listed .png and .PNG as two different file types- image1 is .PNG; could that pose a problem? What is the difference between the two?
There shouldn't be a difference.

Stefan
LaTeX.org admin
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Include Graphics not Working

Post by localghost »

jrichey wrote:[...] The file "image1" is a .png file that I pasted into Paint and saved as a .png. [...]
Make sure that the file has the right suffix (extension) so that its full name is image1.png.


Best regards and welcome to the board
Thorsten
jrichey
Posts: 6
Joined: Tue Sep 15, 2009 10:43 pm

Re: Include Graphics not Working

Post by jrichey »

For some reason, I can open a new document, paste the code from the existing one into the new document, and run it with no problems- the graphics show up with no errors. But, once I save the new file, it runs into the same error with the graphics once again. This is a pretty weird problem- it seems to indicate that there is something wrong with a saved file.

What's going on here?
Post Reply