图形和标题与多个 includegraphics 命令并排显示

图形和标题与多个 includegraphics 命令并排显示

我正在努力适应此解决方案(最佳选项)用于将标题放在图形旁边。如果我有一个图形,它可以按预期工作,但是当我尝试添加第二个\includegraphics命令以在第一个图形的正下方获取图像时 - 间距不能按我预期的方式工作(见下图)。我该如何解决这个问题?或者有其他选择吗?我试过了,sidecap但对我来说没用。

1 个图 2 个数字

平均能量损失

\documentclass[11pt]{article}
\usepackage{graphicx}
\usepackage{floatrow}
\usepackage[showframe]{geometry}

\begin{document}

\begin{figure}
\floatbox[{\capbeside\thisfloatsetup{capbesideposition={left,top},capbesidewidth=0.4\textwidth}}]{figure}[\FBwidth]
{\caption{A test figure with its caption side by side - works fine if I only have one includegraphics}\label{fig:test}}
{\includegraphics[width=0.5\textwidth]{example-grid-100x100pt}}
\end{figure}

\begin{figure}
\floatbox[{\capbeside\thisfloatsetup{capbesideposition={left,top},capbesidewidth=0.4\textwidth}}]{figure}[\FBwidth]
{\caption{With two includegraphics everything is pushed to the right outside the page borders}\label{fig:test}}
{\includegraphics[width=0.5\textwidth]{example-grid-100x100pt} \\ \includegraphics[width=0.5\textwidth]{example-image-b}}
\end{figure}

\end{document}  

答案1

我假设您的两张图片只有一个标题,该标题与两张图片的上方对齐。在下面的 MWE 中,我使用了 来tabular帮助定位图像:

在此处输入图片描述

\documentclass[11pt]{article}
\usepackage{graphicx}
\usepackage{floatrow}
\usepackage[showframe]{geometry}

\begin{document}
\begin{figure}
\floatbox[{\capbeside\thisfloatsetup{capbesideposition={left,top},capbesidewidth=0.4\textwidth}}]{figure}[\FBwidth]
{\caption{With two includegraphics everything is pushed to the right outside the page borders}\label{fig:test}}
{\begin{tabular}{@{}l@{}}\includegraphics[width=0.5\textwidth]{example-grid-100x100pt} \\
\includegraphics[width=0.5\textwidth]{example-image-b}\end{tabular}
}
\end{figure}

\end{document}

相关内容