我想要为这三个图添加一个标题,但我希望它像标题一样。我的代码是:
\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}