开发者

Loading images in LaTeX

开发者 https://www.devze.com 2022-12-30 17:42 出处:网络
I\'m in a documen开发者_开发技巧tclass in LaTeX. How do I load an image saved as a .png file?If you work with pdflatex (direct compilation to pdf), you can use the graphicx package using the \\include

I'm in a documen开发者_开发技巧tclass in LaTeX. How do I load an image saved as a .png file?


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}


Use the graphicx package (included in most LaTeX distributions), which lets you:

\includegraphics[width=3in]{foo.png}

See an example page to get you started.


I am not using pdflatex. On Ubuntu, I use the convert command, that comes with imagemagick, to convert from .png to .eps, and then use includegraphics.

0

精彩评论

暂无评论...
验证码 换一张
取 消