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 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?

share|improve this question
2  
This looks like a more detailed version of your first question. If this is so, please delete one of the two questions (perhaps the older one). –  lockstep Feb 14 '13 at 17:21
    
The easiest route is to put your .eps files in the same folder than your tex file. This answer, however can be elaborated if you want the figures in a different folder, or if your "main document" is indeed a bunch of tex files in different folders. –  JLDiaz Feb 14 '13 at 17:33
    
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. –  Tobi Mar 31 '13 at 11:54
add comment

2 Answers 2

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

share|improve this answer
    
I want to thank you for answering my question. It is clear that now I can add pictures where I want. –  Rakesh Sharma Feb 14 '13 at 19:32
    
My pleasure @RakeshSharma. If you think you have the right answer, you may choose to accept my answer. –  Umar Kalim Feb 14 '13 at 19:48
    
Is the picture free? If yes can you please add an link? –  Kurt Feb 14 '13 at 22:01
    
Thanks @Kurt for pointing it out. The picture may not be for public use. I've removed it now. I just Googled and used the picture, I should have been careful. I think it is a book cover .... –  Umar Kalim Feb 15 '13 at 6:14
    
+1 for the epstopdf package –  guillem Feb 15 '13 at 6:24
add comment

For the sake of completeness...

Q: Do I need to create a directory where to store these pictures?

Q: What should be the location of this directory?

It is not necessary to put the figures (or other files required for the typesetting of the document, as tex files, bib files, etc...) into specific directories. This means that you can organize your files in a way that suits to you, and latex and friends can be persuaded to adapt to your structure. It is just a matter of specifiyng the path unambiguously. Defining a relative path as Umar Kalim does in his answer is a good practice, minimizing both keystrokes and errors.

Q: What kind of file extensions do I need to have for these files?

If you want to include figures, you will probably want to use the includegraphics command from the graphicx package. If you specify the filename without extension, as in \includegraphics{path/to/file}, the eps extension will be added when compiling with latex, and the pdf extension will be added when compiling with pdflatex (for this to work the two versions of the file should be present in the same directory).

The file types supported natively are:

  • latex: can include EPS files with graphicx package (some dvi viewers may fail to show the image though)

  • pdflatex: according to the manual page,

    In PDF mode, pdfTeX can natively handle the PDF, JPG, JBIG2, and PNG graphics formats.

    As stated in Umar's answer, with the epstopdf package it is possible to include eps graphics into pdf files (the package automatically converts the file to pdf format, so the tool epstopdf needs to be present in your system)

If your file is not in any of these formats, it has to be converted to one of the above mentioned. Automatic conversions (i.e., performed by (pdf)latex at compilation time) can be forced using the \DeclareGraphicsRule command: take a look at Using macros in \DeclareGraphicsRule statement using shell command, Add tif image to LaTeX and related questions.

share|improve this answer
add comment

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.