我正在尝试显示 2 行子图,每行包含 3 个子图。但是,子图之间的水平间距不相等,而且两行之间的间距似乎也不同?如何才能使子图在图中居中且间距相等,同时子图之间的间距很小?
我的代码:
\begin{figure}[ht]
\centering
\begin{subfigure}[b]{0.32\textwidth}
\centering
\includegraphics[width=\textwidth]{testImage}
\label{fig7:a}
\vspace{1ex}
\end{subfigure}%%
\hfill
\begin{subfigure}[b]{0.32\textwidth}
\centering
\includegraphics[width=\textwidth]{testImage}
\label{fig7:b}
\vspace{1ex}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.32\textwidth}
\centering
\includegraphics[width=\textwidth]{testImage}
\label{fig7:c}
\vspace{1ex}
\end{subfigure}
\begin{subfigure}[b]{0.32\textwidth}
\centering
\includegraphics[width=\textwidth]{testImage}
\label{fig7:d}
\end{subfigure}%%
\hfill
\begin{subfigure}[b]{0.32\textwidth}
\centering
\includegraphics[width=\textwidth]{testImage}
\label{fig7:e}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.32\textwidth}
\centering
\includegraphics[width=\textwidth]{testImage}
\label{fig7:f}
\end{subfigure}
\label{fig7}
\end{figure}
结果图像:
答案1
像这样:
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}[ht]
\begin{subfigure}[b]{0.32\textwidth}
\includegraphics[width=\textwidth]{testImage}
\label{fig7:a}
\end{subfigure}%
\hfill
\begin{subfigure}[b]{0.32\textwidth}
\includegraphics[width=\textwidth]{testImage}
\label{fig7:b}
\end{subfigure}%
\hfill
\begin{subfigure}[b]{0.32\textwidth}
\includegraphics[width=\textwidth]{testImage}
\label{fig7:c}
\end{subfigure}%
\vspace{-0.5\baselineskip}
\begin{subfigure}[b]{0.32\textwidth}
\includegraphics[width=\textwidth]{testImage}
\label{fig7:d}
\end{subfigure}%
\hfill
\begin{subfigure}[b]{0.32\textwidth}
\includegraphics[width=\textwidth]{testImage}
\label{fig7:e}
\end{subfigure}%
\hfill
\begin{subfigure}[b]{0.32\textwidth}
\includegraphics[width=\textwidth]{testImage}
\label{fig7:f}
\end{subfigure}%
\caption{my figures}
\label{fig7}
\end{figure}
\end{document}
我仅删除所有必要的\centering
和\vspace{1ex}
内部环境subfigure
,更改%
后subfigure
环境的存在(现在是每个环境后一个subfigure
),并在第三个图像后插入空行(并用它开始新行)。