有用户希望将子图的标签都贴在图片上面去,这样可以让子图的显示更清晰,特别是异形排版的时候比较好用。下面的代码可以给你些启发。
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption,subcaption,tikz}
\DeclareCaptionFormat{suboverlay}{\gdef\subcapoverlay{(\thesubfigure) #3\par}}
\DeclareCaptionStyle{suboverlay}{format=suboverlay}
\captionsetup[subfigure]{format=suboverlay}
\newcommand{\subcaptionOverlay}[1]{%
\subcaption{}%
\begin{tikzpicture}
\node [inner sep=0,anchor=south west]at (-3ex,-2ex) (image) {#1};
\draw node [black] {\subcapoverlay};
\end{tikzpicture}%
}
\begin{document}
\begin{figure}%
\begin{minipage}{.25\textwidth}
\begin{subfigure}{\textwidth}
\centering\textbf{Title 1}
\subcaptionOverlay{\includegraphics[width=\textwidth]{example-image}}
\end{subfigure}
\begin{subfigure}{\textwidth}
\centering\textbf{Title 3}
\subcaptionOverlay{\includegraphics[width=\textwidth]{example-image}}
\end{subfigure}
\end{minipage}
\hfill
\begin{minipage}{.25\textwidth}
\begin{subfigure}{\textwidth}
\centering\textbf{Title 2}
\subcaptionOverlay{\includegraphics[width=\textwidth]{example-image}}
\end{subfigure}
\begin{subfigure}{\textwidth}
\centering\textbf{Title 4}
\subcaptionOverlay{\includegraphics[width=\textwidth]{example-image}}
\end{subfigure}
\end{minipage}
\hfill
\begin{minipage}{.45\textwidth}
\begin{subfigure}{\textwidth}
\centering\textbf{Title 5}
\subcaptionOverlay{\includegraphics[width=\textwidth]{example-image}}
\end{subfigure}
\end{minipage}
\end{figure}
\end{document}