<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://wiki.riguz.com/index.php?action=history&amp;feed=atom&amp;title=Latex_insert_image</id>
	<title>Latex insert image - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.riguz.com/index.php?action=history&amp;feed=atom&amp;title=Latex_insert_image"/>
	<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Latex_insert_image&amp;action=history"/>
	<updated>2026-06-03T02:03:21Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=Latex_insert_image&amp;diff=3850&amp;oldid=prev</id>
		<title>Riguz：​/* 使用`subcaption`包 */</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Latex_insert_image&amp;diff=3850&amp;oldid=prev"/>
		<updated>2023-12-19T11:35:13Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;使用`subcaption`包&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2023年12月19日 (二) 11:35的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l126&quot;&gt;第126行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第126行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://tex.stackexchange.com/questions/16207/image-from-includegraphics-showing-up-in-wrong-location Image from \includegraphics showing up in wrong location?]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://tex.stackexchange.com/questions/16207/image-from-includegraphics-showing-up-in-wrong-location Image from \includegraphics showing up in wrong location?]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://tex.stackexchange.com/questions/122314/figures-what-is-the-difference-between-using-subfig-or-subfigure Figures: What is the difference between using subfig or subfigure]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://tex.stackexchange.com/questions/122314/figures-what-is-the-difference-between-using-subfig-or-subfigure Figures: What is the difference between using subfig or subfigure&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]&#039;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:LaTeX]&lt;/ins&gt;]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki_db:diff:1.41:old-3780:rev-3850:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Riguz</name></author>
	</entry>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=Latex_insert_image&amp;diff=3780&amp;oldid=prev</id>
		<title>Riguz：​Riguz移动页面Blog:LaTeX(2)：插入图片至Latex insert image，不留重定向</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Latex_insert_image&amp;diff=3780&amp;oldid=prev"/>
		<updated>2023-12-19T05:59:32Z</updated>

		<summary type="html">&lt;p&gt;Riguz移动页面&lt;a href=&quot;/index.php?title=Blog:LaTeX(2)%EF%BC%9A%E6%8F%92%E5%85%A5%E5%9B%BE%E7%89%87&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Blog:LaTeX(2)：插入图片（页面不存在）&quot;&gt;Blog:LaTeX(2)：插入图片&lt;/a&gt;至&lt;a href=&quot;/Latex_insert_image&quot; title=&quot;Latex insert image&quot;&gt;Latex insert image&lt;/a&gt;，不留重定向&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2023年12月19日 (二) 05:59的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;zh-Hans-CN&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;（没有差异）&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Riguz</name></author>
	</entry>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=Latex_insert_image&amp;diff=2456&amp;oldid=prev</id>
		<title>imported&gt;Riguz：​在LaTeX中插入图片有些类似于Markdown中的方式。</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Latex_insert_image&amp;diff=2456&amp;oldid=prev"/>
		<updated>2020-02-08T00:00:00Z</updated>

		<summary type="html">&lt;p&gt;在LaTeX中插入图片有些类似于Markdown中的方式。&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
在LaTeX中插入图片有些类似于Markdown中的方式。&lt;br /&gt;
&lt;br /&gt;
= Figure和图片=&lt;br /&gt;
可以使用Figure的方式插入图片：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;latex&amp;quot;&amp;gt;&lt;br /&gt;
\usepackage{graphicx} % 需要导入graphicx包&lt;br /&gt;
&lt;br /&gt;
\begin{figure}[h!]&lt;br /&gt;
	\includegraphics[width=\linewidth]{src/1.jpg}&lt;br /&gt;
	\caption{冠状病毒的示意图}&lt;br /&gt;
	\label{fig:virus}&lt;br /&gt;
\end{figure}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
这样生成的效果如图所示：&lt;br /&gt;
&amp;lt;img src=&amp;quot;/images/Latex-image-figure.png&amp;quot; style=&amp;quot;width:400px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
值得注意的是，在LaTeX中，图片和表格等是浮动元素，Tex会自动帮你找个地方放着。据说这样做的原因是因为它希望你专注在写作内容上面，等你完成了内容再回头来调整格式。因为没有这种经验，所以不确定这样是否是最好的方式，不过我们可能更习惯直接放在我们想放的位置上，所以这里是必须的：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;latex&amp;quot;&amp;gt;&lt;br /&gt;
begin{figure}[h]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
这里后面有一个`h!`，有这样一些可用的参数：&lt;br /&gt;
&lt;br /&gt;
* $h$ere: 就放在这里&lt;br /&gt;
* $t$op： 放在页面顶部&lt;br /&gt;
* $b$ottom: 页面底部&lt;br /&gt;
* $p$age: 放在单独的页面&lt;br /&gt;
* $!$(Override)：强制放在指定的位置&lt;br /&gt;
&lt;br /&gt;
虽然我们已经用了`h!`来强制将图片放在页面的位置，但是很有可能页面余下的空间并不足以放入这张图片，这个时候，这个选项会失效。如果依然确定要将图片放入到下面，可以引入`float`包，使用`H`选项：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;latex&amp;quot;&amp;gt;&lt;br /&gt;
\usepackage{float}&lt;br /&gt;
&lt;br /&gt;
\begin{figure}[H]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
就像下面这样：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;img src=&amp;quot;/images/Latex-image-float-H.png&amp;quot; style=&amp;quot;width:400px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= 多张图片排版=&lt;br /&gt;
如果要将多张图片排版到一起，可以有多种方法。&lt;br /&gt;
&lt;br /&gt;
== 使用`subfig`包==&lt;br /&gt;
&lt;br /&gt;
[https://ctan.org/pkg/subfig subfig]是一个可以支持嵌套Figure或者表格的包，这个包是`subfigure`包的替代品，后者已经被弃用了。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;latex&amp;quot;&amp;gt;&lt;br /&gt;
\usepackage{subfig}&lt;br /&gt;
&lt;br /&gt;
\begin{figure}&lt;br /&gt;
	\centering&lt;br /&gt;
	\subfloat[信息锅]{&lt;br /&gt;
		\includegraphics[width=0.4\linewidth, height=80pt]{src/3.jpg}&lt;br /&gt;
	}&lt;br /&gt;
	\subfloat[硬气功]{&lt;br /&gt;
		\includegraphics[width=0.4\linewidth, height=80pt]{src/4.jpg}&lt;br /&gt;
	}&lt;br /&gt;
	\caption{两种气功流派}&lt;br /&gt;
	\label{fig:qg}&lt;br /&gt;
\end{figure}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
这样排版出来的效果如下：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;img src=&amp;quot;/images/Latex-subfig.png&amp;quot; style=&amp;quot;width:400px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 使用`subfloat`包==&lt;br /&gt;
&lt;br /&gt;
[www.ctan.org/pkg/subfloat subfloat]是另一个包，用法如下：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;latex&amp;quot;&amp;gt;&lt;br /&gt;
\begin{subfigures}&lt;br /&gt;
\begin{figure}&lt;br /&gt;
	\centering&lt;br /&gt;
	\fbox{&lt;br /&gt;
		\includegraphics[width=0.4\linewidth, height=80pt]{src/3.jpg}&lt;br /&gt;
	}&lt;br /&gt;
	\caption{信息锅}&lt;br /&gt;
\end{figure}&lt;br /&gt;
\begin{figure}&lt;br /&gt;
	\centering&lt;br /&gt;
	\fbox{&lt;br /&gt;
		\includegraphics[width=0.4\linewidth, height=80pt]{src/4.jpg}&lt;br /&gt;
	}&lt;br /&gt;
	\caption{硬气功}&lt;br /&gt;
\end{figure}&lt;br /&gt;
\end{subfigures}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
这样出来的效果是这样：&lt;br /&gt;
&amp;lt;img src=&amp;quot;/images/Latex-subfloag.png&amp;quot; style=&amp;quot;width:400px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
两张图片不在一行，没有找到怎么把他们放到一起的方法，也不知道是否支持。&lt;br /&gt;
&lt;br /&gt;
== 使用`subcaption`包==&lt;br /&gt;
&lt;br /&gt;
另有使用[http://www.ctan.org/pkg/caption caption]和[http://www.ctan.org/pkg/subcaption subcaption]包结合的方式。`subcaption`包更加新一些，可能更适合选用。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;latex&amp;quot;&amp;gt;&lt;br /&gt;
\usepackage{caption}&lt;br /&gt;
\usepackage{subcaption} &lt;br /&gt;
&lt;br /&gt;
\begin{figure}&lt;br /&gt;
\centering&lt;br /&gt;
\subcaptionbox{信息锅}{&lt;br /&gt;
	\includegraphics[width=0.40\textwidth, height=80pt]{src/3.jpg}&lt;br /&gt;
}&lt;br /&gt;
\hfill&lt;br /&gt;
\subcaptionbox{硬气功}{&lt;br /&gt;
	\includegraphics[width=0.40\textwidth, height=80pt]{src/4.jpg}&lt;br /&gt;
}&lt;br /&gt;
\caption{两种气功流派}&lt;br /&gt;
\end{figure}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
注意subcaption包貌似和前面两种方法中的某一种可能不兼容。效果如下：&lt;br /&gt;
&amp;lt;img src=&amp;quot;/images/Latex-subcaption.png&amp;quot; style=&amp;quot;width:400px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
如果去掉`\hfill`之后，效果基本上和第一种差不多了。&lt;br /&gt;
&lt;br /&gt;
参考：&lt;br /&gt;
&lt;br /&gt;
* [https://tex.stackexchange.com/questions/16207/image-from-includegraphics-showing-up-in-wrong-location Image from \includegraphics showing up in wrong location?]&lt;br /&gt;
* [https://tex.stackexchange.com/questions/122314/figures-what-is-the-difference-between-using-subfig-or-subfigure Figures: What is the difference between using subfig or subfigure]&lt;/div&gt;</summary>
		<author><name>imported&gt;Riguz</name></author>
	</entry>
</feed>