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.

Firstly and fore-mostly I am a complete new comer to the world of LaTeX and so please do bear with me. I will try to be as accurate as I can but if you need any more info please let me know.

All I want is to figure out how to import a graphic into LaTeX (MacTeX).

I am using the following in my code:

\documentclass[10pt,a4paper,draft]{report}
\usepackage{graphicx}

Then in my document section I'm using

\begin{figure}
\includegraphics[width = 50mm]{Name.jpg}
\caption{Label}
\end{figure}

Once I compile the document, the area for the picture has been allocated but there is no image, I have tried .png and .pdf files also.

I know that this is a very simple question and I hope there is a simple solution but I cannot find anything on the net about this (which may mean I'm being dim).

Also I'm using Latexian but I have tried 4 different editors and it doesn't work in any.

share|improve this question
    
In order to include a JPG image, you cannot compile using latex. You need to compile with a different compiler - pdflatex, for example. –  Werner Feb 16 '12 at 7:29
    
Are you specifying the draft option with \documentclass? –  egreg Feb 16 '12 at 9:09
2  
You should always make small but complete examples like the one of Peter instead of sending code snippets. This will avoid that you left out important informations (like "are you using draft or not?"). You should also look in the log-file if there are errors or messages. If you don't understand the log: make it available on the net (remove confidential informations like your name if necessary but let everything else untouched). –  Ulrike Fischer Feb 16 '12 at 11:07
    
Thank you everybody, It was in fact, that I was using the draft tag (this was automatically added to the preamble using a wizard). I apologise for not including the full code I was using. I was trying to be as specific as possible (due to the big ugly warning I got prior to posting the question) but unfortunately this back-fired. I do however know this for the future and will always try to include as much as I can. I suspect that as I become more acquainted with this very nice piece of software I will become more efficient at portraying my difficulties. Thanks again, your help is much apprecia –  Promethean_Sin Feb 16 '12 at 19:00
    
As suggested below I have now added the \documentclass that was causing the issue, when draft was changed to final, all worked –  Promethean_Sin Feb 16 '12 at 21:15
show 2 more comments

migrated from stackoverflow.com Feb 16 '12 at 8:52

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 6 down vote accepted

In the same directory where I have the file with the code below I have the file EiffelTowerNight.jpg. Typesetting the code below with pfdlatex results in the image being produced:

enter image description here

Notes:

  • If you add the demo option to the graphicx package as in \usepackage[demo]{graphicx} then this will be displayed as

    enter image description here

  • If you use the draft option to the class as in \documentclass[draft]{article}, then this will be displayed as:

    enter image description here

Code:

\documentclass{article}
\usepackage{graphicx}

\begin{document}
\begin{figure}
    \centering
    \includegraphics[width = 50mm]{EiffelTowerNight.jpg}
    \caption{Label}
\end{figure}
\end{document}
share|improve this answer
    
I believe that if you leave the file extension off (.jpg, .pdf, etc), assuming you have the appropriate versions of your image file available, both the latex and pdflatex compilers will search for their 'preferred' image format and insert the image. I have done this successfully but do not have the TeX code on hand. Drop me a response if you'd like me to dig it up. –  Carl Witthoft Feb 16 '12 at 14:06
1  
In view of the OP's comment, would you add the information about the draft option in \documentclass, that can be countermanded calling graphics with the final option? –  egreg Feb 16 '12 at 19:07
    
let me know if you want anything else adding –  Promethean_Sin Feb 16 '12 at 21:15
    
@egreg: Added two failure modes: draft option for \documentclass and demo option for graphicx. –  Peter Grill Feb 17 '12 at 0:32
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.