How to insert an image into LaTeX document?
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.
What I did: Convert any images to *.eps here: http://www.go2convert.com/ or with any commercial software you have for that. You also need two packages, one standard for dealing with images and another one for converting from eps to pdf file while compile.
\usepackage{graphicx}
\usepackage{epstopdf} %%package to overcome problem with eps in pdf files
\begin{figure}
\centering
\includegraphics[totalheight=8cm]{images/verticalcell.eps}
\caption{used by \citet[p.~4]{XXXXX}.}
\label{fig:verticalcell}
\end{figure}
or like that:
\begin{figure}[tph!]
\centerline{\includegraphics[totalheight=6cm]{images/verticalcell.eps}}
\caption{used by \citet[p.~4]{XXXXX}.}
\label{fig:verticalcell}
\end{figure}