![水平使用两个子图时,图形未垂直对齐](https://linux22.com/image/434206/%E6%B0%B4%E5%B9%B3%E4%BD%BF%E7%94%A8%E4%B8%A4%E4%B8%AA%E5%AD%90%E5%9B%BE%E6%97%B6%EF%BC%8C%E5%9B%BE%E5%BD%A2%E6%9C%AA%E5%9E%82%E7%9B%B4%E5%AF%B9%E9%BD%90.png)
我正在尝试设置两个子图 a 并采用以下方式:
\begin{figure}
\centering
\begin{subfigure}[a]{0.475\textwidth}
\includegraphics[width=1\linewidth]{Figures/performance-deltasize-1.pdf}
\caption{Minimal change}
\label{fig:performance:deltasize:1}
\end{subfigure}
\begin{subfigure}[b]{0.475\textwidth}
\includegraphics[width=1\linewidth]{Figures/performance-deltasize-2.pdf}
\caption{Real-life author changes}
\label{fig:performance:deltasize:2}
\end{subfigure}
\caption{Delta size---minimal vs. real-life author changes: Delta size per algorithm applied to the same original JATS---once on the modified JATS with minimal text edit and once with real-life author changes}
\label{fig:performance:deltasize}
\end{figure}
我已经检查了标签和标题的顺序,但仍然存在相同的对齐问题。
答案1
我相信您正在使用 subcaption 包,它被设置为包含最少的 LaTeX 代码来说明您的问题。subfigure 环境的可选参数处理定位,而不是将子图标记为“a”或“b”,这是自动完成的。如果删除“[a]”和“[b]”,则图形应该对齐。
\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}{0.475\textwidth}
\includegraphics[width=\linewidth]{figure1.png}
\caption{Minimal change}
\label{fig:performance:deltasize:1}
\end{subfigure}\hfill{}
\begin{subfigure}{0.475\textwidth}
\includegraphics[width=\linewidth]{figure2.png}
\caption{Real-life author changes}
\label{fig:performance:deltasize:2}
\end{subfigure}
\caption{Delta size---minimal vs. real-life author changes: Delta size per algorithm applied to the same original JATS---once on the modified JATS with minimal text edit and once with real-life author changes}
\label{fig:performance:deltasize}
\end{figure}
\end{document}
这是输出。