我如何为更多子图添加标题?

我如何为更多子图添加标题?

我想要为这三个图添加一个标题,但我希望它像标题一样。我的代码是:

\usepackage{graphicx}
\usepackage{subcaption}

\begin{figure}
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{image1.jpg}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{image2.jpg}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{image3.jpg}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{image4.jpg}
    \end{subfigure}
\end{figure}

在此处输入图片描述

答案1

在此处输入图片描述

在此处输入图片描述

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}
  \centering
  \caption{A caption for all images at once}
  \begin{subfigure}[b]{0.2\textwidth}
    \includegraphics[width=\textwidth]{example-image}
  \end{subfigure}
  \begin{subfigure}[b]{0.2\textwidth}
    \includegraphics[width=\textwidth]{example-image-a}
  \end{subfigure}
  \begin{subfigure}[b]{0.2\textwidth}
    \includegraphics[width=\textwidth]{example-image-b}
  \end{subfigure}
  \begin{subfigure}[b]{0.2\textwidth}
    \includegraphics[width=\textwidth]{example-image-c}
  \end{subfigure}
\end{figure}
\begin{figure}
  \centering
  \textbf{\Large Something like a title}
  \medskip
  
  \begin{subfigure}[b]{0.2\textwidth}
    \includegraphics[width=\textwidth]{example-image}
  \end{subfigure}
  \begin{subfigure}[b]{0.2\textwidth}
    \includegraphics[width=\textwidth]{example-image-a}
  \end{subfigure}
  \begin{subfigure}[b]{0.2\textwidth}
    \includegraphics[width=\textwidth]{example-image-b}
  \end{subfigure}
  \begin{subfigure}[b]{0.2\textwidth}
    \includegraphics[width=\textwidth]{example-image-c}
  \end{subfigure}
\end{figure}
\end{document}

相关内容