I wish to include my 1.png
image into the LaTeX document, however I get the error when using the command as below:
\begin{figure}
\centering
\includegraphics{1.png}
\caption{Figure 1: A picture of the same gull looking the other way! }
\label{fig:verticalcell}
\end{figure}
or
\usepackage{graphicx}
\graphicspath{{../pdf/}{C:\Users\User\Desktop\IEEE_CS_Latex\1.png}}
Here is my path: C:\Users\User\Desktop\IEEE_CS_Latex\1.png
Updated:
\documentclass[conference]{IEEEtran}
\usepackage{graphicx}
\begin{figure}
\centering
\includegraphics{\graphicspath{1.png}
\caption{Figure 1: A picture of the same gull looking the other way! }
\label{fig:verticalcell}
\end{figure}
Updated 2:
\begin{figure}[!t]
\centering
\includegraphics[width=2.5in]{1}
% where an .eps filename suffix will be assumed under latex,
% and a .pdf suffix will be assumed for pdflatex; or what has been declared
% via \DeclareGraphicsExtensions.
\caption{Simulation Results}
\label{fig_sim}
\end{figure}
Updated 3:
Updated 4:
% *** GRAPHICS RELATED PACKAGES ***
%
\ifCLASSINFOpdf
\usepackage[pdftex]{graphicx}
% declare the path(s) where your graphic files are
\graphicspath{{../1/}{../png/}}
% and their extensions so you won't have to specify these with
% every instance of \includegraphics
\DeclareGraphicsExtensions{.png}
\else
% or other class option (dvipsone, dvipdf, if not using dvips). graphicx
% will default to the driver specified in the system graphics.cfg if no
% driver is specified.
% \usepackage[dvips]{graphicx}
% declare the path(s) where your graphic files are
% \graphicspath{{../eps/}}
% and their extensions so you won't have to specify these with
% every instance of \includegraphics
% \DeclareGraphicsExtensions{.eps}
\fi
% graphicx was written by David Carlisle and Sebastian Rahtz. It is
% required if you want graphics, photos, etc. graphicx.sty is already
% installed on most LaTeX systems. The latest version and documentation can
% be obtained at:
% http://www.ctan.org/tex-archive/macros/latex/required/graphics/
% Another good source of documentation is "Using Imported Graphics in
% LaTeX2e" by Keith Reckdahl which can be found as epslatex.ps or
% epslatex.pdf at: http://www.ctan.org/tex-archive/info/
%
% latex, and pdflatex in dvi mode, support graphics in encapsulated
% postscript (.eps) format. pdflatex in pdf mode supports graphics
% in .pdf, .jpeg, .png and .mps (metapost) formats. Users should ensure
% that all non-photo figures use a vector format (.eps, .pdf, .mps) and
% not a bitmapped formats (.jpeg, .png). IEEE frowns on bitmapped formats
% which can result in "jaggedy"/blurry rendering of lines and letters as
% well as large increases in file sizes.
%
% You can find documentation about the pdfTeX application at:
% http://www.tug.org/applications/pdftex
Best Answer
In general, when including graphics in LaTeX you should:
For the common case of a graphic in the same directory (folder), this means things are usually as simple as
where the
figure
environment is needed to allow floating and captioning (but not required to insert a figure 'here': a common misunderstanding).Another common case is having figures in a subdirectory of the main document directory: something like
figures
,graphics
, ...:Notice that
\graphicspath
is used in the preamble, and that each path should be included in braces and use/
for subdivision and at the end. (Not everyone is keen on\graphicspath
, but for the case I've outlined of a per-document figures directory it works well in my opinion).These instructions apply to most document classes (a few odd ones deliberately mess with parts of this process, but they are unusual and really not well designed, in general!).