[Tex/LaTex] How to include images

graphics

I am trying to include math pictures in my document.

I have added

\usepackage{graphicx}
\usepackage{epstopdf}

These two packages inside the header
and then the following code

\setlength{\unitlength}{0.8cm}
\begin{picture}(6,5)
\put(3.5,0.4){$\displaystyle
s:=\frac{a+b+c}{2}$}
\put(1,1){\includegraphics[
  width=2cm,height=2cm]{picture.eps}}
\end{picture}

However, I keep on getting error: picture.eps is missing

Q: Do I need to create a directory where to store these pictures?
Q: What should be the location of this directory?
Q: What kind of file extensions do I need to have for these files?

Best Answer

What I typically do is to create a folder, say figures, to organize all images. The folder hierarchy would be:

latex-project/
    figures/
        foxjumpingoverdog.jpg
        ...
    document.tex
    ...

Then add the command \graphicspath{./figures/} in the preamble of the document to point to the folder.

Using the package epstopdf allows us to incorporate .eps figures.

A MWE followed by the output is below:

\documentclass{article} 

\usepackage[demo]{graphicx} 
\graphicspath{ {./figures/} }
\usepackage{epstopdf}

\begin{document}
\noindent The quick brown fox jumps over the lazy dog. See Figure~\ref{fig:figurelbl}.

    \begin{figure}[h]
      \centering
      \includegraphics[width=0.5\textwidth]{foxjumpingoverdog}
      \caption{\label{fig:figurelbl} An illustration of the quick brown fox \emph{jumping} over the lazy dog.}
    \end{figure} 

\end{document}

snapshot