有没有办法使用 subcaption 和 floatrow 包将子标题标签放在最接近子图的位置

有没有办法使用 subcaption 和 floatrow 包将子标题标签放在最接近子图的位置

我想最大化用于子图的图片的尺寸,为此我想将子图标签尽可能靠近子图。我找不到使用 subcaption 和 floatrow 来实现这一点的方法。到目前为止,我实现的是这段代码,但我无法缩小 (a) 和图形之间的距离,(b) 也是如此。并将 (a) 推到最左边。

\documentclass[headsepline,DIV=12]{scrbook}
\usepackage{caption}
\usepackage[labelformat=simple]{subcaption}
\renewcommand\thesubfigure{(\alph{subfigure})}
\usepackage{graphicx}
\usepackage{floatrow}

\floatsetup[subfigure]{heightadjust=object,capbesideposition=top}
\captionsetup[subfigure]{labelfont=bf,textfont=normalfont}

\begin{document}
\begin{figure}[H]
      \ffigbox[]
          {\begin{subfloatrow}
                 \fcapside[\FBwidth]{\caption{}\label{sfa}}{\includegraphics[height=0.2\textheight]{example-image-a}}
                 \fcapside[\FBwidth]{\caption{}\label{sfb}}{\includegraphics[height=0.2\textheight]{example-image-b}}
          \end{subfloatrow}
          }
      {\caption{
      \subref{sfa} and \subref{sfb} Recalcitrantes ut ut postulat tenus tenus et praefectum custodiri formidine
iusserim haec per contumacem novo quid ignorare haec custodiri quid novo maiestati quod ut praefectum strepit
praefectum quid ignorare quod quae strepit et strepit custodiri quid recalcitrantes inusitato iratus et iusserim
haec nimirum contumacem per formidine tumore contumacem ordo tumore. }\label{f:test}
      }
\end{figure}
Long text under my figure where I can reference any of the Fig~\ref{f:test} and subfigure~\subref{sfa} with some special names
kemmlkem mlake lka elmk .
\end{document}

在此处输入图片描述

目前,我在与 floatrow 包的斗争中失败了,但我还没有结束!

如果您能帮助我,非常感谢!

答案1

subfig我的评论中建议的解决方案在使用包而subcaption不是使用{...}时效果很好\ffigbox[]

\documentclass{article}
\usepackage{floatrow}
\usepackage{graphicx}
\usepackage[label font=bf, labelformat=simple]{subfig}
\usepackage{caption}
\floatsetup[figure]{style=plain,subcapbesideposition=top}
\captionsetup[subfloat]{labelfont=bf,textfont=normalfont,labelformat=parens}

\begin{document}
%---------------------------------------------------------------%
    \begin{figure}[ht]
    \centering
    \setkeys{Gin}{height=0.2\textheight} % common settings for images heights
    \setlength{\labelsep}{1mm}  % <---
\sidesubfloat[]{\includegraphics{example-image}\label{sfa}}
\hfil
\sidesubfloat[]{\includegraphics{example-image}\label{sfb}}
    \caption{\protect\subref{sfa} and \protect\subref{sfb} Recalcitrantes ut ut postulat tenus tenus et praefectum custodiri formidine iusserim haec per contumacem novo quid ignorare haec custodiri quid novo maiestati quod ut praefectum strepit praefectum quid ignorare quod quae strepit et strepit custodiri quid recalcitrantes inusitato iratus et iusserim haec nimirum contumacem per formidine tumore contumacem ordo tumore.}
\label{f:test}
    \end{figure}
Long text under my figure where I can reference any of the Fig~\ref{f:test} and subfigure~\subref{sfa} with some special names \dots
\end{document}

结果几乎与您的 MWE 相同(除了标题标签和图像之间的距离由 控制\setlength{\labelsep}{1mm}):

在此处输入图片描述

相关内容