minipage和subfigure

本文介绍在LaTeX中使用minipage环境并排显示两个独立Figure的方法,包括解决caption对齐问题,适用于单栏文档。通过具体示例代码展示了如何配置,并解释了宽度设置及tikzpicture环境的使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题:
当我们使用单栏文档时,需要将两个独立的Figure并排显示出来,而非不是两个subfigure并排显示,那么如何做呢?

方法:
1.对于两个子图,很容易使用\begin{subfigure}来实现并排显示,但对于独立的Figure就不行,因为独立的Figure有自己独立的区域,需要在其中嵌入\begin{minipage}来实现;

2.具体用法如下:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}

%这里是配置子图并排显示的方法
\begin{figure}
\centering
\begin{subfigure}{.5\textwidth}
  \centering
  \includegraphics[width=.4\linewidth]{image1}
  \caption{A subfigure}
  \label{fig:sub1}
\end{subfigure}%

\begin{subfigure}{.5\textwidth}
  \centering
  \includegraphics[width=.4\linewidth]{image1}
  \caption{A subfigure}
  \label{fig:sub2}
\end{subfigure}
\caption{A figure with two subfigures}
\label{fig:test}
\end{figure}

%这里是两个独立Figure并排显示的方法
\begin{figure}
\centering
\begin{minipage}{.5\textwidth}
  \centering
  \includegraphics[width=.4\linewidth]{image1}
  \captionof{figure}{A figure}
  \label{fig:test1}
\end{minipage}%

\begin{minipage}{.5\textwidth}
  \centering
  \includegraphics[width=.4\linewidth]{image1}
  \captionof{figure}{Another figure}
  \label{fig:test2}
\end{minipage}
\end{figure}

\end{document}
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46

注意:

  • \end{minipage}%这个后面的%是必须的。图显示的具体宽度是由\begin{minipage}{.5\textwidth}和\includegraphics[width=.4\linewidth]共同决定的;
  • 其次,tikzpicture环境可以位于minipage内;

完成上述写法后可能还会存在caption不对齐的现象,则需要给**每个**minipage指定参数[b],即:

\begin{minipage}[b]{0.6\textwidth}
\end{minipage}
 
  • 1
  • 2
					<link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-df60374684.css" rel="stylesheet">
            </div>
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值