Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loading images in LaTeX

Tags:

latex

I'm in a documentclass in LaTeX. How do I load an image saved as a .png file?

like image 824
sabre2t Avatar asked May 16 '10 20:05

sabre2t


1 Answers

If you work with pdflatex (direct compilation to pdf), you can use the graphicx package using the \includegraphics command. If your image is called foo.png, you can add the following command inside your document.

\includegraphics{foo}

However, if you work with latex (compilation into dvi first), you cannot use 'png' file as image (with any package). You have to convert your image into 'eps' first. If your image is called foo.png, then you can convert it with any graphics software into foo.eps, and use the following command to include the image.

\includegraphics{foo}

Here is a complete example with width specification:

\documentclass{article}
\usepackage{graphicx}

\begin{document}
Here is my image.
\includegraphics[width=\textwidth]{foo}
\end{document}
like image 64
Lohrun Avatar answered Sep 19 '22 13:09

Lohrun