答案1
我认为您不需要subfigure
您展示的图的包。以下是 John Kormylo 答案的扩展。
% subcaptionprob.tex SE 564314
% This is mainly from John Kormylo's answer
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
%\usepackage{showframe}% MWE only
\begin{document}
\begin{figure}[htp]
\raisebox{\dimexpr 0.5\baselineskip-0.5\height}% center baseline
{\includegraphics[width=0.9\linewidth, height=1in]{example-image}}%
\parbox[c]{0.1\linewidth}{\subcaption{}}\par
\vspace{\baselineskip}
\raisebox{\dimexpr 0.5\baselineskip-0.5\height}% center baseline
{\includegraphics[width=0.9\linewidth, height=1in]{example-image-golden}}%
\parbox[c]{0.1\linewidth}{\subcaption{}}\par
\caption{Two (sub)figures}
\end{figure}
\end{document}
它会在一个图形中生成两幅图像,其标题位于右侧。
答案2
此解决方案将 放置\subcaption
在单独的 中\parbox
。请注意,宽度之和应为\linewidth
。
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{showframe}% MWE only
\begin{document}
\begin{figure}[htp]
\raisebox{\dimexpr 0.5\baselineskip-0.5\height}% center baseline
{\includegraphics[width=0.9\linewidth, height=1in]{example-image}}%
\parbox[c]{0.1\linewidth}{\subcaption{}}\par
\end{figure}
\end{document}