LaTeX子图排版艺术从基础到精通的Overleaf实战指南在学术写作和技术文档中数据可视化的重要性不言而喻。当我们需要展示多组对比实验结果或相关数据序列时如何优雅地将它们排列在同一页面既保持专业美观又确保信息传达清晰是每位作者都会面临的挑战。手动调整间距、对齐和尺寸不仅耗时耗力还常常导致最终效果不尽如人意。本文将带你深入LaTeX子图排版的核心技巧从基础概念到高级布局控制让你彻底告别繁琐的手动调整。1. 子图排版基础理解LaTeX的图形生态系统LaTeX提供了多种方式来处理图形和子图传统的subfigure包虽然仍被广泛使用但现代LaTeX文档更推荐使用subcaption包与graphicx的组合。这套组合不仅语法更清晰而且与其他LaTeX元素的兼容性更好。要开始使用子图功能首先需要在文档导言区加载必要的包\documentclass{article} \usepackage{graphicx} % 图形支持 \usepackage{subcaption} % 现代子图支持 \usepackage{lipsum} % 仅用于生成示例文本subcaption包提供了subfigure环境它比传统的subfigure包更加灵活。一个基本的子图布局代码如下\begin{figure}[htbp] \centering \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{example-image-a} \caption{第一个子图} \label{fig:sub1} \end{subfigure} \hfill \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{example-image-b} \caption{第二个子图} \label{fig:sub2} \end{subfigure} \caption{双图并排示例} \label{fig:parallel} \end{figure}这段代码创建了两个并排的子图每个子图占据文本宽度的48%中间留有4%的间距通过\hfill实现。关键参数说明[b]对齐选项表示子图底部对齐0.48\textwidth子图环境的宽度\textwidth图形在子图环境中的宽度2. 精准控制间距与对齐的高级技巧子图排版中最常见的挑战是如何精确控制元素间的间距和对齐方式。LaTeX提供了多种工具来实现这一目标理解它们的相互作用是掌握子图排版的关键。2.1 水平间距控制水平间距主要通过以下方式调整固定间距使用\hspace{长度}命令\begin{subfigure}{0.3\textwidth}...\end{subfigure} \hspace{1cm} \begin{subfigure}{0.3\textwidth}...\end{subfigure}弹性间距使用\hfill命令自动填充可用空间\begin{subfigure}{0.3\textwidth}...\end{subfigure} \hfill \begin{subfigure}{0.3\textwidth}...\end{subfigure}比例间距通过调整子图宽度比例间接控制间距\begin{subfigure}{0.45\textwidth}...\end{subfigure} \begin{subfigure}{0.45\textwidth}...\end{subfigure}2.2 垂直间距控制垂直间距主要通过以下方式调整固定间距使用\vspace{长度}命令\begin{subfigure}{0.8\textwidth}...\end{subfigure} \vspace{0.5cm} \begin{subfigure}{0.8\textwidth}...\end{subfigure}对齐控制使用子图环境的对齐选项[t]顶部对齐[b]底部对齐[c]居中对齐默认2.3 混合布局实战复杂的子图布局往往需要混合水平和垂直排列。以下是一个2×2网格布局的示例\begin{figure}[htbp] \centering \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{example-image-a} \caption{左上图} \label{fig:grid1} \end{subfigure} \hfill \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{example-image-b} \caption{右上图} \label{fig:grid2} \end{subfigure} \vspace{0.5cm} \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{example-image-c} \caption{左下图} \label{fig:grid3} \end{subfigure} \hfill \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{example-image} \caption{右下图} \label{fig:grid4} \end{subfigure} \caption{2×2网格布局示例} \label{fig:grid} \end{figure}3. 尺寸与比例打造完美视觉平衡子图排版不仅仅是技术问题更是视觉设计问题。保持图形间的和谐比例对于专业文档至关重要。3.1 等宽与等高控制LaTeX提供了多种方式控制图形尺寸固定宽度\includegraphics[width5cm]{filename}相对宽度\includegraphics[width0.3\textwidth]{filename}固定高度\includegraphics[height4cm]{filename}同时控制宽高\includegraphics[width5cm, height4cm]{filename}保持宽高比推荐\includegraphics[width5cm, keepaspectratio]{filename}3.2 统一子图尺寸的技巧当子图来源不同时保持统一尺寸可能具有挑战性。以下是几种实用方法使用adjustbox包\usepackage{adjustbox} \begin{subfigure}{0.3\textwidth} \adjustbox{width\textwidth, height3cm, keepaspectratio}{\includegraphics{fig1}} \end{subfigure}预定义统一尺寸\newcommand{\subfigwidth}{0.3\textwidth} \newcommand{\subfigheight}{3cm}使用\savebox预计算尺寸\newsavebox{\tempbox} \savebox{\tempbox}{\includegraphics{fig1}} \begin{subfigure}{\wd\tempbox} \usebox{\tempbox} \end{subfigure}4. Overleaf实战从零构建专业子图模板Overleaf作为流行的在线LaTeX编辑器为子图排版提供了便利的环境。下面我们将一步步创建一个可直接复用的专业子图模板。4.1 项目设置创建新项目选择空白项目上传你的图像文件建议使用有意义的文件名在主文档中添加必要的包\documentclass{article} \usepackage{graphicx} \usepackage{subcaption} \usepackage{geometry} % 控制页面边距 \geometry{a4paper, margin2cm}4.2 双图并排模板\begin{figure}[htbp] \centering \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth, height5cm, keepaspectratio]{fig1} \caption{实验组结果} \label{fig:exp} \end{subfigure} \hfill \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth, height5cm, keepaspectratio]{fig2} \caption{对照组结果} \label{fig:ctrl} \end{subfigure} \caption{实验结果对比} \label{fig:results} \end{figure}4.3 三图混合布局模板\begin{figure}[htbp] \centering \begin{subfigure}[t]{0.32\textwidth} \includegraphics[width\textwidth]{phase1} \caption{阶段一} \label{fig:phase1} \end{subfigure} \hfill \begin{subfigure}[t]{0.32\textwidth} \includegraphics[width\textwidth]{phase2} \caption{阶段二} \label{fig:phase2} \end{subfigure} \hfill \begin{subfigure}[t]{0.32\textwidth} \includegraphics[width\textwidth]{phase3} \caption{阶段三} \label{fig:phase3} \end{subfigure} \vspace{0.5cm} \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{comparison} \caption{综合对比} \label{fig:comp} \end{subfigure} \hfill \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{analysis} \caption{数据分析} \label{fig:analysis} \end{subfigure} \caption{三阶段实验过程与结果分析} \label{fig:process} \end{figure}4.4 常见问题解决方案在Overleaf中使用子图时可能会遇到以下问题子图编号不正确确保导言区加载了\usepackage{subcaption}检查是否有其他图形包冲突间距效果不符合预期尝试在\hspace和\vspace中使用\baselineskip作为单位例如\vspace{0.5\baselineskip}图形位置不理想调整figure环境的可选参数组合使用[htbp]或[H]需要float包子图标题格式不一致使用\captionsetup统一设置\captionsetup[subfigure]{labelfontbf, textfontit}5. 高级技巧与最佳实践掌握了基础布局后下面这些高级技巧能让你的子图排版更上一层楼。5.1 自定义子图样式通过subcaption包提供的接口可以自定义子图的多种样式% 导言区设置 \captionsetup[subfigure]{ labelfontbf, % 标签字体加粗 textfontsmall, % 文本小号字体 justificationcentering, % 居中 labelsepspace % 标签与文本间加空格 }5.2 复杂引用系统子图可以像普通图形一样被引用但提供了更灵活的引用方式如图\ref{fig:process}所示特别是\subref{fig:phase2}阶段...5.3 自动调整布局对于大量子图手动调整可能繁琐。可以使用\foreach命令需要pgffor包自动生成\usepackage{pgffor} \begin{figure}[htbp] \centering \foreach \i in {1,...,4} { \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{fig\i} \caption{图\i} \label{fig:auto\i} \end{subfigure} \ifodd\i\hfill\else\vspace{0.5cm}\fi } \caption{自动生成的子图布局} \label{fig:autolayout} \end{figure}5.4 与文本的和谐融合专业文档中子图应该与周围文本和谐统一。几个实用建议保持一致的边距子图组合的宽度应略小于文本宽度合理使用空白子图与文本间保留至少\baselineskip的间距标题风格统一主标题与子标题使用协调的样式引用位置恰当在段落中合理位置引用子图避免见图X堆积6. 性能优化与跨平台兼容大型文档中子图过多可能导致编译问题。以下优化技巧值得关注图形格式选择优先使用PDF或EPS格式矢量图对于位图PNG优于JPEG预编译图形\usepackage{graphicx} \graphicspath{{figures/}} % 设置图形路径 \DeclareGraphicsExtensions{.pdf,.png,.jpg} % 限定扩展名缓存机制在Overleaf中启用--shell-escape选项使用mylatexformat预编译常用图形跨平台注意事项使用相对路径而非绝对路径避免空格和特殊字符的文件名统一使用小写扩展名7. 从优秀到卓越专业排版细节真正专业的子图排版体现在细节处理上。以下几个常被忽视的细节能显著提升文档质量标题内容子图标题应简洁但信息完整避免在标题中重复主标题信息标签命名使用有意义的标签名保持一致的命名约定例如fig:model-arch、fig:exp-results图形质量确保所有子图分辨率一致检查图形在打印时的清晰度颜色使用学术文档优先考虑黑白打印效果使用高对比度颜色组合字体协调图形中的字体应与文档主体协调避免图形中字体过大或过小8. 实战案例学术论文中的子图应用让我们看一个完整的学术论文子图应用实例展示如何将前述技巧综合运用\documentclass[twocolumn]{article} \usepackage{graphicx} \usepackage{subcaption} \usepackage{lipsum} % 仅用于生成示例文本 \begin{document} \section{实验结果与分析} \lipsum[1][1-3] % 示例文本 \begin{figure*}[t] % 跨栏图形 \centering \begin{subfigure}[b]{0.3\textwidth} \includegraphics[width\textwidth]{setup} \caption{实验装置} \label{fig:exp-setup} \end{subfigure} \hfill \begin{subfigure}[b]{0.3\textwidth} \includegraphics[width\textwidth]{raw-data} \caption{原始数据} \label{fig:raw-data} \end{subfigure} \hfill \begin{subfigure}[b]{0.3\textwidth} \includegraphics[width\textwidth]{processed} \caption{处理结果} \label{fig:processed} \end{subfigure} \vspace{0.5cm} \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{comparison} \caption{方法对比} \label{fig:comparison} \end{subfigure} \hfill \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{analysis} \caption{误差分析} \label{fig:error-analysis} \end{subfigure} \caption{完整实验过程与结果分析} \label{fig:full-results} \end{figure*} \lipsum[2][1-4] % 更多示例文本 如图\ref{fig:full-results}所示我们的实验包含...特别值得注意的是\subref{fig:error-analysis}中显示的... \end{document}这个例子展示了跨栏图形布局figure*环境混合行内和行间间距控制专业的标签和引用系统与正文内容的自然融合9. 调试与问题排查即使经验丰富的LaTeX用户也会遇到子图排版问题。以下是系统化的排查方法编译错误检查包冲突特别是subfigure与subcaption确保所有图形文件存在且路径正确布局异常检查宽度总和是否超过\textwidth验证\hspace和\vspace单位是否正确编号问题检查是否有重复标签确保\label位于\caption之后Overleaf特定问题清除缓存Menu → Compiler → Clear Cache尝试切换编译器LaTeX vs pdfLaTeX专业调试技巧添加\showthe\textwidth检查实际宽度使用layout包可视化页面布局临时添加边框辅助调试\usepackage{framed} \begin{subfigure}{0.3\textwidth} \begin{framed} \includegraphics[...]{...} \end{framed} \end{subfigure}10. 扩展资源与进阶学习要真正掌握LaTeX子图排版持续学习和实践至关重要。以下推荐资源值得收藏官方文档subcaption包文档texdoc subcaptiongraphicx包文档texdoc graphicx在线资源Overleaf的LaTeX学习资源CTAN上的相关包文档实用工具Inkscape创建和编辑矢量图形GIMP处理位图图像TikZ直接使用LaTeX代码创建图形进阶技巧与TikZ结合创建复杂布局使用pgfplots创建一致的数据可视化探索floatrow包提供的额外功能社区支持TeX StackExchange专业问题解答LaTeX社区论坛中文用户交流GitHub上的LaTeX模板仓库
别再手动调间距了!Latex子图布局终极指南:用subfigure搞定多图排版(含Overleaf实战)
发布时间:2026/6/7 12:39:37
LaTeX子图排版艺术从基础到精通的Overleaf实战指南在学术写作和技术文档中数据可视化的重要性不言而喻。当我们需要展示多组对比实验结果或相关数据序列时如何优雅地将它们排列在同一页面既保持专业美观又确保信息传达清晰是每位作者都会面临的挑战。手动调整间距、对齐和尺寸不仅耗时耗力还常常导致最终效果不尽如人意。本文将带你深入LaTeX子图排版的核心技巧从基础概念到高级布局控制让你彻底告别繁琐的手动调整。1. 子图排版基础理解LaTeX的图形生态系统LaTeX提供了多种方式来处理图形和子图传统的subfigure包虽然仍被广泛使用但现代LaTeX文档更推荐使用subcaption包与graphicx的组合。这套组合不仅语法更清晰而且与其他LaTeX元素的兼容性更好。要开始使用子图功能首先需要在文档导言区加载必要的包\documentclass{article} \usepackage{graphicx} % 图形支持 \usepackage{subcaption} % 现代子图支持 \usepackage{lipsum} % 仅用于生成示例文本subcaption包提供了subfigure环境它比传统的subfigure包更加灵活。一个基本的子图布局代码如下\begin{figure}[htbp] \centering \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{example-image-a} \caption{第一个子图} \label{fig:sub1} \end{subfigure} \hfill \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{example-image-b} \caption{第二个子图} \label{fig:sub2} \end{subfigure} \caption{双图并排示例} \label{fig:parallel} \end{figure}这段代码创建了两个并排的子图每个子图占据文本宽度的48%中间留有4%的间距通过\hfill实现。关键参数说明[b]对齐选项表示子图底部对齐0.48\textwidth子图环境的宽度\textwidth图形在子图环境中的宽度2. 精准控制间距与对齐的高级技巧子图排版中最常见的挑战是如何精确控制元素间的间距和对齐方式。LaTeX提供了多种工具来实现这一目标理解它们的相互作用是掌握子图排版的关键。2.1 水平间距控制水平间距主要通过以下方式调整固定间距使用\hspace{长度}命令\begin{subfigure}{0.3\textwidth}...\end{subfigure} \hspace{1cm} \begin{subfigure}{0.3\textwidth}...\end{subfigure}弹性间距使用\hfill命令自动填充可用空间\begin{subfigure}{0.3\textwidth}...\end{subfigure} \hfill \begin{subfigure}{0.3\textwidth}...\end{subfigure}比例间距通过调整子图宽度比例间接控制间距\begin{subfigure}{0.45\textwidth}...\end{subfigure} \begin{subfigure}{0.45\textwidth}...\end{subfigure}2.2 垂直间距控制垂直间距主要通过以下方式调整固定间距使用\vspace{长度}命令\begin{subfigure}{0.8\textwidth}...\end{subfigure} \vspace{0.5cm} \begin{subfigure}{0.8\textwidth}...\end{subfigure}对齐控制使用子图环境的对齐选项[t]顶部对齐[b]底部对齐[c]居中对齐默认2.3 混合布局实战复杂的子图布局往往需要混合水平和垂直排列。以下是一个2×2网格布局的示例\begin{figure}[htbp] \centering \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{example-image-a} \caption{左上图} \label{fig:grid1} \end{subfigure} \hfill \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{example-image-b} \caption{右上图} \label{fig:grid2} \end{subfigure} \vspace{0.5cm} \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{example-image-c} \caption{左下图} \label{fig:grid3} \end{subfigure} \hfill \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{example-image} \caption{右下图} \label{fig:grid4} \end{subfigure} \caption{2×2网格布局示例} \label{fig:grid} \end{figure}3. 尺寸与比例打造完美视觉平衡子图排版不仅仅是技术问题更是视觉设计问题。保持图形间的和谐比例对于专业文档至关重要。3.1 等宽与等高控制LaTeX提供了多种方式控制图形尺寸固定宽度\includegraphics[width5cm]{filename}相对宽度\includegraphics[width0.3\textwidth]{filename}固定高度\includegraphics[height4cm]{filename}同时控制宽高\includegraphics[width5cm, height4cm]{filename}保持宽高比推荐\includegraphics[width5cm, keepaspectratio]{filename}3.2 统一子图尺寸的技巧当子图来源不同时保持统一尺寸可能具有挑战性。以下是几种实用方法使用adjustbox包\usepackage{adjustbox} \begin{subfigure}{0.3\textwidth} \adjustbox{width\textwidth, height3cm, keepaspectratio}{\includegraphics{fig1}} \end{subfigure}预定义统一尺寸\newcommand{\subfigwidth}{0.3\textwidth} \newcommand{\subfigheight}{3cm}使用\savebox预计算尺寸\newsavebox{\tempbox} \savebox{\tempbox}{\includegraphics{fig1}} \begin{subfigure}{\wd\tempbox} \usebox{\tempbox} \end{subfigure}4. Overleaf实战从零构建专业子图模板Overleaf作为流行的在线LaTeX编辑器为子图排版提供了便利的环境。下面我们将一步步创建一个可直接复用的专业子图模板。4.1 项目设置创建新项目选择空白项目上传你的图像文件建议使用有意义的文件名在主文档中添加必要的包\documentclass{article} \usepackage{graphicx} \usepackage{subcaption} \usepackage{geometry} % 控制页面边距 \geometry{a4paper, margin2cm}4.2 双图并排模板\begin{figure}[htbp] \centering \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth, height5cm, keepaspectratio]{fig1} \caption{实验组结果} \label{fig:exp} \end{subfigure} \hfill \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth, height5cm, keepaspectratio]{fig2} \caption{对照组结果} \label{fig:ctrl} \end{subfigure} \caption{实验结果对比} \label{fig:results} \end{figure}4.3 三图混合布局模板\begin{figure}[htbp] \centering \begin{subfigure}[t]{0.32\textwidth} \includegraphics[width\textwidth]{phase1} \caption{阶段一} \label{fig:phase1} \end{subfigure} \hfill \begin{subfigure}[t]{0.32\textwidth} \includegraphics[width\textwidth]{phase2} \caption{阶段二} \label{fig:phase2} \end{subfigure} \hfill \begin{subfigure}[t]{0.32\textwidth} \includegraphics[width\textwidth]{phase3} \caption{阶段三} \label{fig:phase3} \end{subfigure} \vspace{0.5cm} \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{comparison} \caption{综合对比} \label{fig:comp} \end{subfigure} \hfill \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{analysis} \caption{数据分析} \label{fig:analysis} \end{subfigure} \caption{三阶段实验过程与结果分析} \label{fig:process} \end{figure}4.4 常见问题解决方案在Overleaf中使用子图时可能会遇到以下问题子图编号不正确确保导言区加载了\usepackage{subcaption}检查是否有其他图形包冲突间距效果不符合预期尝试在\hspace和\vspace中使用\baselineskip作为单位例如\vspace{0.5\baselineskip}图形位置不理想调整figure环境的可选参数组合使用[htbp]或[H]需要float包子图标题格式不一致使用\captionsetup统一设置\captionsetup[subfigure]{labelfontbf, textfontit}5. 高级技巧与最佳实践掌握了基础布局后下面这些高级技巧能让你的子图排版更上一层楼。5.1 自定义子图样式通过subcaption包提供的接口可以自定义子图的多种样式% 导言区设置 \captionsetup[subfigure]{ labelfontbf, % 标签字体加粗 textfontsmall, % 文本小号字体 justificationcentering, % 居中 labelsepspace % 标签与文本间加空格 }5.2 复杂引用系统子图可以像普通图形一样被引用但提供了更灵活的引用方式如图\ref{fig:process}所示特别是\subref{fig:phase2}阶段...5.3 自动调整布局对于大量子图手动调整可能繁琐。可以使用\foreach命令需要pgffor包自动生成\usepackage{pgffor} \begin{figure}[htbp] \centering \foreach \i in {1,...,4} { \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{fig\i} \caption{图\i} \label{fig:auto\i} \end{subfigure} \ifodd\i\hfill\else\vspace{0.5cm}\fi } \caption{自动生成的子图布局} \label{fig:autolayout} \end{figure}5.4 与文本的和谐融合专业文档中子图应该与周围文本和谐统一。几个实用建议保持一致的边距子图组合的宽度应略小于文本宽度合理使用空白子图与文本间保留至少\baselineskip的间距标题风格统一主标题与子标题使用协调的样式引用位置恰当在段落中合理位置引用子图避免见图X堆积6. 性能优化与跨平台兼容大型文档中子图过多可能导致编译问题。以下优化技巧值得关注图形格式选择优先使用PDF或EPS格式矢量图对于位图PNG优于JPEG预编译图形\usepackage{graphicx} \graphicspath{{figures/}} % 设置图形路径 \DeclareGraphicsExtensions{.pdf,.png,.jpg} % 限定扩展名缓存机制在Overleaf中启用--shell-escape选项使用mylatexformat预编译常用图形跨平台注意事项使用相对路径而非绝对路径避免空格和特殊字符的文件名统一使用小写扩展名7. 从优秀到卓越专业排版细节真正专业的子图排版体现在细节处理上。以下几个常被忽视的细节能显著提升文档质量标题内容子图标题应简洁但信息完整避免在标题中重复主标题信息标签命名使用有意义的标签名保持一致的命名约定例如fig:model-arch、fig:exp-results图形质量确保所有子图分辨率一致检查图形在打印时的清晰度颜色使用学术文档优先考虑黑白打印效果使用高对比度颜色组合字体协调图形中的字体应与文档主体协调避免图形中字体过大或过小8. 实战案例学术论文中的子图应用让我们看一个完整的学术论文子图应用实例展示如何将前述技巧综合运用\documentclass[twocolumn]{article} \usepackage{graphicx} \usepackage{subcaption} \usepackage{lipsum} % 仅用于生成示例文本 \begin{document} \section{实验结果与分析} \lipsum[1][1-3] % 示例文本 \begin{figure*}[t] % 跨栏图形 \centering \begin{subfigure}[b]{0.3\textwidth} \includegraphics[width\textwidth]{setup} \caption{实验装置} \label{fig:exp-setup} \end{subfigure} \hfill \begin{subfigure}[b]{0.3\textwidth} \includegraphics[width\textwidth]{raw-data} \caption{原始数据} \label{fig:raw-data} \end{subfigure} \hfill \begin{subfigure}[b]{0.3\textwidth} \includegraphics[width\textwidth]{processed} \caption{处理结果} \label{fig:processed} \end{subfigure} \vspace{0.5cm} \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{comparison} \caption{方法对比} \label{fig:comparison} \end{subfigure} \hfill \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width\textwidth]{analysis} \caption{误差分析} \label{fig:error-analysis} \end{subfigure} \caption{完整实验过程与结果分析} \label{fig:full-results} \end{figure*} \lipsum[2][1-4] % 更多示例文本 如图\ref{fig:full-results}所示我们的实验包含...特别值得注意的是\subref{fig:error-analysis}中显示的... \end{document}这个例子展示了跨栏图形布局figure*环境混合行内和行间间距控制专业的标签和引用系统与正文内容的自然融合9. 调试与问题排查即使经验丰富的LaTeX用户也会遇到子图排版问题。以下是系统化的排查方法编译错误检查包冲突特别是subfigure与subcaption确保所有图形文件存在且路径正确布局异常检查宽度总和是否超过\textwidth验证\hspace和\vspace单位是否正确编号问题检查是否有重复标签确保\label位于\caption之后Overleaf特定问题清除缓存Menu → Compiler → Clear Cache尝试切换编译器LaTeX vs pdfLaTeX专业调试技巧添加\showthe\textwidth检查实际宽度使用layout包可视化页面布局临时添加边框辅助调试\usepackage{framed} \begin{subfigure}{0.3\textwidth} \begin{framed} \includegraphics[...]{...} \end{framed} \end{subfigure}10. 扩展资源与进阶学习要真正掌握LaTeX子图排版持续学习和实践至关重要。以下推荐资源值得收藏官方文档subcaption包文档texdoc subcaptiongraphicx包文档texdoc graphicx在线资源Overleaf的LaTeX学习资源CTAN上的相关包文档实用工具Inkscape创建和编辑矢量图形GIMP处理位图图像TikZ直接使用LaTeX代码创建图形进阶技巧与TikZ结合创建复杂布局使用pgfplots创建一致的数据可视化探索floatrow包提供的额外功能社区支持TeX StackExchange专业问题解答LaTeX社区论坛中文用户交流GitHub上的LaTeX模板仓库