4

我有一个关于将图像插入 LaTeX 文档的问题。我尝试使用键盘快捷键插入图像:Ctrl- Alt-G我可以插入图像。但是编译后的 pdf 文档最后显示了所有图像,而我想将图像与文本交错。类似于以下内容:

Text1
Image1
Text2
Image2
Text3
Image3

我尝试在正确的位置插入图像,即在文本之间,但在编译时,它们都出现在最后。我尝试了图像插入 UI 上提供的不同选项,但结果相同。

知道我哪里出错了。

相关的SO 问题

4

9 回答 9

10

您必须使用graphicsx 包

\usepackage{graphicx}

然后你只需使用 \includegraphics

\includegraphics{myfig.pdf}
\includegraphics[width=60mm]{myfig.png}
\includegraphics[height=60mm]{myfig.jpg}
\includegraphics[scale=0.75]{myfig.pdf}
\includegraphics[angle=45,width=52mm]{myfig.jpg}
于 2009-04-06T14:45:14.120 回答
5

尝试缩小图像。也许它们太大了,所以它们被移到了文档的末尾。

希望能帮助到你。

于 2009-04-06T14:04:51.847 回答
4

您在 \figure 环境中使用了什么代码?在大多数情况下,“h”选项至少应该有一点帮助。

于 2009-04-06T14:06:40.670 回答
3

这是一个常见问题解答:“在 LaTeX 中移动表格和图形”。特别注意第三个点,它放宽了 LaTeX 用于定位浮点数的一些限制。

这是我可以给出的最佳答案,而无需查看浮点数有多大以及如何将它们插入文档的示例。只要它们尺寸合理,您应该没有问题

\begin{图}[htbp]
  \includegraphics{myfig}
  \标题{...}
  \标签{无花果:我的无花果}
\结束{图}

请注意,如果浮动太大而无法容纳,那么它将移动到后续页面 - 这是让 LaTeX 帮助您进行格式化的整个想法。您当然不希望仅仅因为接下来出现一个不合适的数字而过早结束页面。

于 2009-04-06T23:27:02.510 回答
2

也许这可以总体上对您有所帮助...我只是讨厌 LaTeX 始终使一切都变得过于先进(灵活)的方式。此外,来源看起来真的很糟糕。它不会解决您最初的问题,但是由于更改每个图像的大小会更容易,您至少可以尝试...

% Easy image insert
%   use as \img{imagename}{caption}{label}
%   will insert image with with 70% of textwidth
%   change below for other width
\newcommand{\img}[3]{
    \begin{figure}[!ht]
        \centering
            \includegraphics[width=0.7\textwidth]{#1}
        \caption{#2}
        \label{fig:#3}
    \end{figure}
}

\img{myimage}{有这个标题}{and_this_label}

标签会自动以 fig: 为前缀。祝你好运!/C

于 2009-06-05T09:30:01.190 回答
1

在图形环境中使用 [!t] 和 [!h],而不是 [t]、[h] 等似乎会有所帮助,尽管我还没有找到一种万无一失的方法来在合理的地方获取大图像。有时它会在文档中途运行,有时则不会。

于 2011-02-15T21:43:08.807 回答
0

有时,只需使用 includegraphics 语句的选项(文件名 aka 之前的方括号\includegraphics[width=foo]{})更改宽度或高度即可。

于 2012-08-10T22:27:14.967 回答
0
\begin{figure}[H!]
  \includegraphics{myfig}
  \caption{...}
  \label{fig:myfig}
\end{figure}

用于H!表示您希望您的图片就在此处。

于 2012-11-15T22:03:10.240 回答
-1
\documentclass{article}
\usepackage{graphicx}

\begin{document}
 text
\begin{figure}[tbh]
\centering
\includegraphics[width=0.4 \textheight]{ & directory path of jpg. width defines the width of the page and one one can put in its place height which is text page height }

\caption{name of the jpg} 
\end{figure}
% it worked for me.

\end{document}
于 2021-09-18T13:05:41.690 回答