子图对齐

子图对齐

-为什么包括子图在内的这幅图没有水平居中?

-如何充分利用文本宽度?

值为 0.25 时产生 3x5 网格。

\documentclass[14pt, a4paper]{extreport}
\usepackage[left=3.5cm, right=2.5cm, top=3cm, bottom=3cm]{geometry}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{subcaption}
\begin{document}
\begin{figure}[htbp]
\centering
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}

\caption{Classification results of different MFCC extractions}
\label{fig:7.1}
\end{figure}
\end{document}

答案1

在此处输入图片描述

我将图表整理如下:

\documentclass[14pt, a4paper]{book}%{extreport}
\usepackage[showframe,
            left=3.5cm, right=2.5cm, top=3cm, bottom=3cm]{geometry}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}
    \begin{figure}
\centering
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=\linewidth]{example-image-b}
\end{subfigure}\hfil
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=\linewidth]{example-image-b}
\end{subfigure}\hfil
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=\linewidth]{example-image-b}
\end{subfigure}\hfil
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=\linewidth]{example-image-b}
\end{subfigure}

\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=\linewidth]{example-image-b}
\end{subfigure}\hfil
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=\linewidth]{example-image-b}
\end{subfigure}\hfil
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\end{subfigure}\hfil
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=\linewidth]{example-image-b}
\end{subfigure}

\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=\linewidth]{example-image-c}
\end{subfigure}\hfil
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\end{subfigure}\hfil
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=\linewidth]{example-image-b}
\end{subfigure}\hfil
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=\linewidth]{example-image-c}
\end{subfigure}

\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\end{subfigure}\hfil
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=\linewidth]{example-image-b}
\end{subfigure}\hfil
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=\linewidth]{example-image-c}
\end{subfigure}\hfil
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=\linewidth]{example-image}
\end{subfigure}
    \caption{Classification results of different MFCC extractions}
\label{fig:7.1}
    \end{figure}
\end{document}

答案2

这是您第二个问题的答案。未注释的行尾会产生额外的空格,因此总长度会比 长\textwidth。请参见以下第一行值为 0.25 的示例:

\documentclass[14pt, a4paper]{extreport}
\usepackage[left=3.5cm, right=2.5cm, top=3cm, bottom=3cm]{geometry}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{subcaption}
\begin{document}
\begin{figure}[htbp]
\centering
\begin{subfigure}[b]{0.25\textwidth}%
\includegraphics[width=0.25\textwidth]{example-image-b}
\end{subfigure}%
\begin{subfigure}[b]{0.25\textwidth}%
\includegraphics[width=0.25\textwidth]{example-image-b}
\end{subfigure}%
\begin{subfigure}[b]{0.25\textwidth}%
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}%
\begin{subfigure}[b]{0.25\textwidth}%
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\includegraphics[width=0.23\textwidth]{example-image-b}
\end{subfigure}

\caption{Classification results of different MFCC extractions}
\label{fig:7.1}
\end{figure}
\end{document}

在此处输入图片描述

相关内容