图片并排排列并带有单个标题?

图片并排排列并带有单个标题?

我的文档中有两张图片,但都只有一个标题。我在论坛上搜索,找到了如何将两张图片并排显示,但我无法获得单个标题。请帮忙

在此处输入图片描述

这是我在论坛上发现并用于我的文档的内容

\documentclass{article}

\usepackage[demo]{graphicx} % remove 'demo' option for production version of file

\begin{document}

\begin{figure}[h!]
\begin{minipage}[t]{0.48\textwidth}
\includegraphics[width=\linewidth,keepaspectratio=true]{fase4.pdf}
\caption{Figura experimental}
\label{fase1}
\end{minipage}
\hspace*{\fill} % it's important not to leave blank lines before and after this command
\begin{minipage}[t]{0.48\textwidth}
\includegraphics[width=\linewidth,keepaspectratio=true]{fase5.pdf}
\caption{Altra figura experimental}
\label{fase2}
\end{minipage}
\end{figure}

\end{document}

答案1

使用 subfig 包:

%%% https://tex.stackexchange.com/questions/402358/pictures-aligned-side-by-side-with-single-caption#402358

\documentclass{article}

\usepackage{subfig}

\usepackage[demo]{graphicx} % remove 'demo' option for production version of file

\begin{document}

\begin{figure}[h!]
  \centering

  \subfloat{\includegraphics[width=.4\linewidth,keepaspectratio=true]{fase4.pdf}}
  \hfill
  \subfloat{\includegraphics[width=.4\linewidth,keepaspectratio=true]{fase5.pdf}}

\caption{Altra figura experimental}
\label{fase2}
\end{figure}

\end{document}

在此处输入图片描述

答案2

\documentclass{article}

\usepackage[demo]{graphicx} % remove 'demo' option for production version of file

\begin{document}

\begin{figure}
\includegraphics[width=.45\linewidth]{example-image}
\hfill
\includegraphics[width=.45\linewidth]{example-image}
\caption{Single caption for both images}
\label{fase2}
\end{figure}

\end{document}

相关内容