You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

LaTeX中subfigure排版异常:子图(d,e)、(f,g)无法同行显示求助

问题分析与修复方案

你的代码出现子图排版不符合预期的原因主要有几点:

  • 未手动分隔行,LaTeX自动换行逻辑不符合你的分组需求
  • \label位置错误,且存在重复标签(会导致引用失效)
  • \hfill的位置混乱,未正确作用于同一行的子图之间

以下是修正后的代码,实现(a,b,c)一行、(d,e)一行、(f,g)一行的排版:

\begin{figure*}[ht] 
  % 第一行:a, b, c
  \subfigure[]{\includegraphics[height=0.45in]{figures/ch3Ex2Picture1a.png}}
  \label{fig1a}
  \hfill
  \subfigure[]{\includegraphics[height=0.45in]{figures/ch3Ex2Picture1b.png}}
  \label{fig1b}
  \hfill
  \subfigure[]{\includegraphics[height=1.2in]{figures/ch3Ex2Picture1c.png}}
  \label{fig1c}
  \\ % 强制换行

  % 第二行:d, e
  \subfigure[]{\includegraphics[height=.8in]{figures/ch3Ex2Picture2.png}}
  \label{fig1d}
  \hfill
  \subfigure[]{\includegraphics[height=.8in]{figures/ch3Ex2Picture3.png}}
  \label{fig1e}
  \\ % 强制换行

  % 第三行:f, g
  \subfigure[]{\includegraphics[height=.88in]{figures/ch3Ex2Picture4.png}}
  \label{fig1f}
  \hfill
  \subfigure[]{\includegraphics[height=.88in]{figures/ch3Ex2Picture5.png}}
  \label{fig1g}

  \caption{Illustration examples}
  \label{Ex2fig3}  
\end{figure*}

关键修改点:

  • 用\\强制分隔每行,明确子图分组
  • 每个\subfigure对应唯一的\label,且紧跟在子图命令后,避免标签错位
  • 将\hfill放在同一行的子图之间,确保子图在该行内均匀分布
  • 清理了代码中的多余空白和换行,提升可读性

如果你的文档使用较新的LaTeX环境,推荐用subcaption包替代旧的subfigure包,语法更清晰且兼容性更好,示例如下:

\usepackage{subcaption} % 导言区加载包

\begin{figure*}[ht] 
  % 第一行
  \begin{subfigure}{0.3\textwidth}
    \includegraphics[height=0.45in]{figures/ch3Ex2Picture1a.png}
    \caption{}
    \label{fig1a}
  \end{subfigure}
  \hfill
  \begin{subfigure}{0.3\textwidth}
    \includegraphics[height=0.45in]{figures/ch3Ex2Picture1b.png}
    \caption{}
    \label{fig1b}
  \end{subfigure}
  \hfill
  \begin{subfigure}{0.3\textwidth}
    \includegraphics[height=1.2in]{figures/ch3Ex2Picture1c.png}
    \caption{}
    \label{fig1c}
  \end{subfigure}
  \\

  % 第二行
  \begin{subfigure}{0.45\textwidth}
    \includegraphics[height=.8in]{figures/ch3Ex2Picture2.png}
    \caption{}
    \label{fig1d}
  \end{subfigure}
  \hfill
  \begin{subfigure}{0.45\textwidth}
    \includegraphics[height=.8in]{figures/ch3Ex2Picture3.png}
    \caption{}
    \label{fig1e}
  \end{subfigure}
  \\

  % 第三行
  \begin{subfigure}{0.45\textwidth}
    \includegraphics[height=.88in]{figures/ch3Ex2Picture4.png}
    \caption{}
    \label{fig1f}
  \end{subfigure}
  \hfill
  \begin{subfigure}{0.45\textwidth}
    \includegraphics[height=.88in]{figures/ch3Ex2Picture5.png}
    \caption{}
    \label{fig1g}
  \end{subfigure}

  \caption{Illustration examples}
  \label{Ex2fig3}  
\end{figure*}

这种方式通过指定子图宽度,能更精准控制排版,避免因图片高度差异导致的对齐问题。

内容的提问来源于stack exchange,提问作者Negar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 00:55:19