[Tex/LaTex] How to insert an image into LaTeX document

graphics

I have already included graphicx package and include

\ifCLASSINFOpdf
\usepackage[pdftex]{graphicx}
% declare the path(s) where your graphic files are
\graphicspath{{../pdf/}{D:\ImagesforProjectLatex}}
 % and their extensions so you won't have to specify these with
 % every instance of \includegraphics
 \DeclareGraphicsExtensions{.pdf,.jpeg,.png}

In the place that I want to insert the image I use the following example.

 \begin{figure}[h!]
 \centering
  \includegraphics[width=0.5\textwidth]{Example}
 \caption{A picture of the same gull
       looking the other way!}
 \end{figure}

I use the "LaTeX => DVI" option.
I am a newbie to LATeX, so I do not know the difference between "LaTeX => PDF" and "LaTeX => PS => PDF"
My ultimate goal is to convert the document into a pdf file. Any help will be much appreciated.

Best Answer

Various pieces of your preamble are superfluous. Just use:

\usepackage{graphicx}
\graphicspath{{../pdf/}{D:\ImagesforProjectLatex}}

That will take care of choosing the right driver whether you're using latex (it will automatically select a driver suitable for xdvi and dvips) or pdflatex. No \ifCLASSINFOpdf is needed. Also, it sets the valid extensions automatically, so you don't have to do that either. Lastly, if you put the pdf-compatible image files and the dvi-compatible image files in the same directory, then you don't need to use the \ifCLASSINFOpdf conditional to set the right \graphicspath.

The figure code later on when you actually insert the image is completely correct. It's exactly what I use when I write.