成功解决 LaTeX 无法实现相同大小子图并排问题

打算在LaTeX中并排插入两张大小相同的图片,步骤如下:

1. 引入宏包

\usepackage{graphicx}
\usepackage{subcaption}

2. 并排插入子图

\begin{figure}[hbt!]
    \centering
    \begin{subfigure}[b]{0.5\linewidth}
        \centering
        \includegraphics[width=\linewidth]{Figures/multi_theme_tsne_title_SBert_Norm.pdf}
		\caption{Aspect: Post texts}
		\label{fig:TSNE_title} 
    \end{subfigure}%

    \begin{subfigure}[b]{0.5\linewidth}
        \centering
        \includegraphics[width=\linewidth]{Figures/multi_theme_tsne_comment_SBert_Norm.pdf}
		\caption{Aspect: Comments}
		\label{fig:TSNE_comment} 
    \end{subfigure}%
	\caption{t-SNE visualization results for different categories. (a) Posts texts; (b) Comments}
	\label{fig:TSNE}
\end{figure}

但运行上述代码,结果如下:

在这里插入图片描述

无法实现两张子图并排显示的效果。反复检查代码还是没有发现任何问题,后来改成下方代码:

\begin{figure}[hbt!]
    \centering
    \begin{subfigure}[b]{0.5\linewidth}
        \centering
        \includegraphics[width=\linewidth]{Figures/multi_theme_tsne_title_SBert_Norm.pdf}
		\caption{Aspect: Post texts}
		\label{fig:TSNE_title} 
    \end{subfigure}%
    \begin{subfigure}[b]{0.5\linewidth}
        \centering
        \includegraphics[width=\linewidth]{Figures/multi_theme_tsne_comment_SBert_Norm.pdf}
		\caption{Aspect: Comments}
		\label{fig:TSNE_comment} 
    \end{subfigure}%
	\caption{t-SNE visualization results for different categories. (a) Posts texts; (b) Comments}
	\label{fig:TSNE}
\end{figure}

成功并排!

在这里插入图片描述

两段代码唯一的差别就在于{subfigure}之间有无空行!

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

_Meilinger_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值