Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
One immediate comment would be that the first line \ifCLASSINFOpdf is used to do stuff only when you are doing Latex=> pdf and be skipped elsewhere. And most probably it should be followed by a \fi if I remember correctly from the IEEE Transactions class file. So try to use the Latex=>PDF, as most of the commands you use are tailored towards PDF. –  percusse May 27 '11 at 0:08
    
Thank you for the comment. Is there any comment on the directory? I guess the problem is due to directory. –  Hephaestus May 27 '11 at 0:30
1  
I think you should always use forward slashes / in paths, even on Windows. –  Caramdir May 27 '11 at 0:48
    
Although I could see that a figure is formed due to its caption, I could not reach the image even if the directory is D://ImagesforProjectLatex/Example what could be the problem? –  Hephaestus May 27 '11 at 0:51
    
@Hephaestus: Look at the answer in: Paths and Linux/Windows slash conventions. It is also valid for \graphicspath. –  Danie Els May 27 '11 at 1:39

3 Answers 3

up vote 1 down vote accepted

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.

share|improve this answer

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}
share|improve this answer

This is an alternative way you can insert graphics into a TeX file on windows.

\centering

\includegraphics{`File Name`.`File extension type`}

For Captions:

\begin{center} 

Figure 1: A picture of the same gull looking the other way! 

\end{center}

Hope thats something of what your looking for, if not, leave a comment and I will be more than gladly to update my response.

share|improve this answer
    
A tip: If you indent lines by 4 spaces, then they are marked as a code sample. You can also highlight the code and click the "code" button (with "101010" on it). –  doncherry May 27 '11 at 9:00
3  
Note that you can skip the file name extension and a set of extension will be tried automatically. Also center is often the wrong way to center an image. It adds some vertical spacing before and after which might or might not be wanted. For figures \centering should be used instead. –  Martin Scharrer May 27 '11 at 18:26
3  
-1: What's wrong with the figure environment? –  Ken Bloom Jun 26 '11 at 17:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.