Graphics, Figures & Tablesincludegraphics only including picture name

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
buggaby
Posts: 6
Joined: Tue Sep 06, 2011 6:20 pm

includegraphics only including picture name

Post by buggaby »

I'm trying to include a picture in my LaTeX document but, upon successful build and execution with no errors, it's not showing the picture. I just see the picture's filename. The proper caption is shown, and it's centered properly, so the code is doing SOMETHING :) just not what I want.

Here's the code I used to include the picture:

Code: Select all

\begin{figure}[htbp]
	\centering
	\includegraphics{testImage.png}
	\caption{This is the caption}
	\label{fig:testImage}
\end{figure}
The picture is in the subfolder "figures" which is itself in the LaTeX project folder. Anyway, I tried using the whole file path for testImage but the output is the same. And I did include the "\usepackage{graphicx}" command in the preamble.

Any ideas?

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

includegraphics only including picture name

Post by Stefan Kottwitz »

Hi,

this can be caused by draft mode. Check if you've set the option draft at the beginning where you specify the document class.

Stefan
LaTeX.org admin
buggaby
Posts: 6
Joined: Tue Sep 06, 2011 6:20 pm

includegraphics only including picture name

Post by buggaby »

Nope, it's not in draft mode. My preamble is simply

Code: Select all

\documentclass{article}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{graphicx}
[
Also, I just read that the draft mode shows the outline of the box the picture will use. In my case, I just get the letters. The picture is quite large but it's only taking up the space needed for the title.
buggaby
Posts: 6
Joined: Tue Sep 06, 2011 6:20 pm

includegraphics only including picture name

Post by buggaby »

Here's my preamble:

Code: Select all

\documentclass{article}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{graphicx}
\begin{document}
Also, if it's in draft mode, that should mean that it would display a box where the picture would go, right? Mine is just displaying the figure name; no box or anything.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

Re: includegraphics only including picture name

Post by Stefan Kottwitz »

So I guess testImage.png is not the real file name, and you have a space in the file name or path. TeX shows such a behavior, printing a path or part of a file name, if a space is in the name, since for TeX a file name ends at the space. Remove spaces or load the grffile package, which can fix it.

Btw. it would not work if you put it into a subfolder without specifying at least a relative path or use \graphicspath or a corresponding environment variable.

Stefan
LaTeX.org admin
buggaby
Posts: 6
Joined: Tue Sep 06, 2011 6:20 pm

Re: includegraphics only including picture name

Post by buggaby »

"testImage.png" is the real filename. Also, I have a copy of the figure in the same directory as the tex file, just to be sure.

I'm noticing that after compiling, it says that it "Couldn't find input index file C:\...\mythesis nor C:\...mythesis.idx" Does that mean maybe how I have installed TeXnicCenter and MikTex is wrong? I seem to be having problems using BibTex, also...
User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

Re: includegraphics only including picture name

Post by Stefan Kottwitz »

The message means that makeindex is used even though you didn't create an index, like you checked "Run makeindex" in the output profile without actually using it.

Regarding your file, please provide a complete small example and the corresponding log file. For example, the .log file shows complete error messages and warnings and which compiler you use - pdfLaTeX supports PNG,, but not LaTeX in dvi mode. You see, guessing just from code snippets didn't lead to the solution yet.

Stefan
LaTeX.org admin
buggaby
Posts: 6
Joined: Tue Sep 06, 2011 6:20 pm

Re: includegraphics only including picture name

Post by buggaby »

I just asked my friend for some advice and he suggested I use WinEDt as an editor. It worked right away. The bibliography is working and the image is being shown. I was using TeXnicCenter before but I realized that it wasn't updating the PDF file at all, even if I just changed some of the text. I don't know why. But it's working now. The code I was using to input the image was fine, it just wasn't being properly implemented by the compiler, I guess.

Anyway, so it's working even though I don't know why it wasn't before. Thanks for the help.
Post Reply