在LaTeX中加载图像

sab*_*e2t 7 latex

我在LaTeX的文档类中.如何加载保存为.png文件的图像?

Loh*_*run 16

如果使用pdflatex(直接编译为pdf),则可以使用graphicx\includegraphics命令使用该包.如果调用了图像,则foo.png可以在文档中添加以下命令.

\includegraphics{foo}
Run Code Online (Sandbox Code Playgroud)

但是,如果您使用latex(首先编译为dvi),则不能将'png'文件用作图像(使用任何包).您必须先将图像转换为"eps".如果调用了图像foo.png,则可以将其与任何图形软件一起转换为foo.eps,并使用以下命令包含图像.

\includegraphics{foo}
Run Code Online (Sandbox Code Playgroud)

以下是宽度规格的完整示例:

\documentclass{article}
\usepackage{graphicx}

\begin{document}
Here is my image.
\includegraphics[width=\textwidth]{foo}
\end{document}
Run Code Online (Sandbox Code Playgroud)


Set*_*son 10

使用该graphicx软件包(包含在大多数LaTeX发行版中),它可以让您:

\includegraphics[width=3in]{foo.png}
Run Code Online (Sandbox Code Playgroud)

请参阅示例页面以帮助您入门.