5

I cannot seem to get the images to appear on latex. I get no error messages and, it has no problems compiling. However, the produced (.pdf) which is what I am using, does not have the image. Essentially, everything I am using is in

\documentclass[12pt,a4paper,epsf,portrait,times,epsfig]{article}

\usepackage[dvips]{graphics}
\usepackage{amsmath}
\usepackage{xspace}
\usepackage{fancybox}
\usepackage{hyperref}
\usepackage{amsfonts}
\usepackage{graphicx}

\renewcommand{\baselinestretch}{1.5}
\setlength{\parskip}{0.2cm}
\setlength{\parindent}{0.0cm}
\setlength{\textheight}{8.5in}
\setlength{\textwidth}{16.0cm}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\topmargin}{0in}

\pagenumbering{arabic}
\numberwithin{equation}{subsection}

\begin{document}

\begin{figure}
    \centering
        \includegraphics{C:/Users/Reza/Desktop/Test/Untitled.jpg}
    \label{fig:Untitled}
\end{figure}

\end{document}

I am using Texniccenter, and using LaTeX=>PDF. Help please!

  • 1
    Welcome to TeX.SE. I took the liberty to format your post a little. See this link for more details on available formatting. Please, try to make your example minimal, i.e. remove every line from your preamble that is not necessary. As a solution suggestion, try to move file Untitled.jpg to the folder where you .tex file is, and use \includegraphics{Untitled.jpg}. As well notice that LaTeX might be case-sensitive and Untitled.jpg is different from untitled.jpg. – yo' May 10 '12 at 17:17
  • Also take a look at your .log file to see if there's a warning or error message. – Jake May 10 '12 at 17:18
  • 3
    The epsf and epsfig options in the \documentclass statement are obsolete. To auto-convert image files in .jpg format to .pdf -- the preferred format of the graphicx package -- be sure to load the epstopdf package. By the way, the \label instruction inside the figure environment won't have any desired effects unless you precede it with a \caption statement. (The "label" is associated by hyperref and other packages with the closest "label-able" item. In the case of your MWE, there is no such item so far. Hence, be sure to provide a \caption statement before the \label. – Mico May 10 '12 at 19:55
  • You need to install Ghostscript software as written here. – Mohamed Nov 12 '15 at 8:43
  • In my case compiling with lualatex instead of pdflatex solved the issue. – loki Nov 11 '19 at 15:43
11

Your file contains incompatibilities.

You use the packages graphics and graphix. Only one is needed. In addition, you specify the dvips driver for graphics. This is not the correct driver if you are using pdflatex (which is what I think you are using).

In addition, you are better off not using complete paths, but rather relative paths. This is what tohecz was suggesting with the \includegraphics{<filename>} and placing your picture in the same folder as your .tex file.

As an example, the following file (by the way, this is what tohecz meant by minimal example) works:

\documentclass[]{article}

\usepackage[]{graphics}
%\usepackage{graphicx}

\begin{document}

\begin{figure}
    \includegraphics{Untitled.jpg}
\end{figure}

\end{document}

If you really want to use the dvips and the other options, then your images must be in .eps format. This means you must convert your .jpg image to .eps. In addition, you will have to compile with something of the form latex -> dvi -> pdf.

1

This is not exactly the answer to the original question, but this is the solution that helped in my case, when the other solution did not work.

In my case the figures were not showing up because I was using obsolete additional arguments natheight and natwidth for the \includegraphics command:

    \includegraphics[width = 3in, natheight = 400, natwidth = 400]{Figure.jpg}

If you are using pdfLaTex (as opposed to dvi output, which cannot determine the size of graphics) they are not necessary, so just remove those options and only specify the output width/height if necessary:

    \includegraphics[width = 3in]{Figure.jpg}
1

For me it was a completely different problem than any other solution I could find. I was using a template with a .cls file and inside that template, the following line was written \AtBeginDocument{\let\includegraphics\NAT@ignore}. Basically it tells the compiler to ignore the \includegraphics{} command. I commented that line and now it works like a charm !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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