【问题标题】:Inserting images in LaTeX在 LaTeX 中插入图像
【发布时间】:2009-04-06 14:01:03
【问题描述】:

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

Text1
Image1
Text2
Image2
Text3
Image3

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

知道我哪里出错了。

相关SO question.

【问题讨论】:

  • 那是什么键盘快捷键?
  • 键盘快捷键? “图像插入用户界面”?这不是我熟悉的任何 LaTeX。你用的是什么应用?
  • 那个“相关”问题应该能准确地给你所需的答案。
  • 编辑器由 TeXnicCenter(用于在 Windows 中开发 LaTeX 文档的免费编辑器)提供,并在其中执行 Ctrl-Alt-G 会显示一个标题为“插入图”的 GUI。

标签: latex pdflatex


【解决方案1】:

你必须使用graphicx package:

\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}

【讨论】:

  • 您肯定想使用 \begin{figure} 环境的一些变体!我认为作者自己插入数字没有任何问题。
【解决方案2】:

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

希望对你有帮助。

【讨论】:

    【解决方案3】:

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

    【讨论】:

      【解决方案4】:

      这是一个常见问题解答:“Moving tables and figures in LaTeX”。请特别注意第三个点,它放宽了 LaTeX 用于定位浮点数的一些限制。

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

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

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

      【讨论】:

        【解决方案5】:

        也许这总体上可以对您有所帮助...我只是讨厌 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

        【讨论】:

          【解决方案6】:

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

          【讨论】:

            【解决方案7】:

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

            【讨论】:

              【解决方案8】:
              \begin{figure}[H!]
                \includegraphics{myfig}
                \caption{...}
                \label{fig:myfig}
              \end{figure}
              

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

              【讨论】:

                【解决方案9】:
                \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}
                

                【讨论】:

                  猜你喜欢
                  • 1970-01-01
                  • 1970-01-01
                  • 2012-08-01
                  • 2011-02-13
                  • 2014-10-21
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  相关资源
                  最近更新 更多