9

This question already has an answer here:

I have a little problem: I am not able to put an image in my document. This is how I start:

\documentclass[a4paper,12pt,titlepage]{report}

\usepackage{fontenc}
\usepackage[italian]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{graphicx}


\begin{document}

.

.

.

\begin{figure}[htbp]

\begin{center}

\includegraphics{mol.png}

\end{center}

\label{fig:uno}

\end{figure}

.

.

.

\end{document}

and this is the error report:

ERROR: LaTeX Error: Cannot determine size of graphic in mol.png (no BoundingBox).

--- TeX said ---

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.67 \includegraphics{mol.png}

Some months ago I used the same procedure and it worked.

I even tried to reproduce the .dvi file from the .tex file that I wrote some months ago but today doesn't work.

Another question: how can I produce a .pdf file from a .tex file? I forgot it.

I'm working on debian using emacs

marked as duplicate by user13907, Reinstate Monica - M. Schröder, Malipivo, Masroor, jub0bs Aug 15 '14 at 21:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

9

If you use the command latex (making dvi) you need to specify the natural size the image natwidth=... natwidth=... (not width= as that tries to scale to that size but still needs the natural size. If you use the command pdflatex (making pdf directly) Then the system can read the file and determine its natural size automatically. In either case it is usually a good idea to omit the extension .png then if different systems understand different image formats they will each pick up the right format.

2

If you use the AucTeX-mode with your Emacs, you can switch the output type between pdf and dvi by typing C-c C-t C-p. Then AucTeX uses pdflatex which handles png-files by default, as @David Carlisle mentioned in his answer.

To have pdf output enabled by default with AucTeX, you can put something like this in our .emacs: (setq TeX-PDF-mode t)

To enable it just for the one particular file each time it is loaded, add something like this to the end of your file:

%%% Local Variables:
%%% mode: latex
%%% TeX-PDF-mode: t
%%% End:

I hope this is helpful.

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