[Tex/LaTex] including .png images with PDFLaTeX through Kile

kilepdftexpng

I have a lot of experience using LaTeX with Miktex/TeXnicCenter on windows, but am only taking baby steps in learning how to do it on ubuntu.
I am using Kile as IDE, since I got the impression from others that that was a good choice.

For some reason, I can't include .png images? My preamble is

\documentclass[a4paper,10pt]{report}
\usepackage[latin1]{inputenc}
\usepackage{graphicx}
\usepackage[danish,UKenglish]{babel}
\usepackage[english]{varioref}
\usepackage{prettyref}
\usepackage{amsmath,amssymb,mathrsfs}
\usepackage{pdfpages}

and I am compiling using the "PDFLaTeX-button", such that the "Log and Messages" goes (for some reason it won't let me copy-paste):

[PDFLateX] metaStable.tex 0> metaStable.pdf (pdflatex)
[PDFLaTeX]finished with exit code 1
(some warnings about hyphenation patterns and the fact that no \author is given)
./metastable.tex:33:Unknown graphics extension: .png . figures/betterBarrier.png}
[PDFLaTeX] 1 error, 2 warnings, 0 badboxes

The offending bit of code is

\begin{figure}
\centering
\includegraphics[width=\LineWidth,keepaspectratio=true]{
figures/betterBarrier.png }
\end{figure}

I assume I am doing something wrong in my build command, but I have no idea where to go look.

The output seems fine except for the lack of the figure.

Best Answer

Two things here:

  1. You should usually not add an extension to your graphics: LaTeX will pick it up automatically
  2. If you do give an extension, watch spaces. You have {figures/betterBarrier.png }, which has a space at the end and so looks for an extension '.png ', and which is therefore wrong. Remove the space.