floatrow と subfig を使用したサブフロート間の水平間隔 (fr-subfig サポートあり)

floatrow と subfig を使用したサブフロート間の水平間隔 (fr-subfig サポートあり)

subfigとを使用して、サブ図を 2 行配置しようとしていますfloatrow。キャプションは希望どおりに配置され、オブジェクトの垂直方向の配置も適切です。ただし、サブ図間の水平方向の間隔を均等にする方法がわかりません。下の行では、2 つの図の間にいくらかのスペースがあり、問題ありません。ただし、上の行では、最初の 2 つの図の間のスペースが、2 番目と 3 番目の図の間のスペースよりも広くなっています。その理由がわかりません。

2 列に 5 つのサブ図

何が足りないのでしょうか?

\documentclass{article}
\usepackage{graphicx,subfig}
\usepackage[heightadjust=all,valign=c]{floatrow}
\usepackage{fr-subfig}

\begin{document}

  \begin{figure}[!htbp]
    \captionsetup[subfigure]{justification=centering}
    \floatbox{figure}{%
      \caption{%
        Components of the system: Penguins (\ref{fig:a}), Jumpers (\ref{fig:b}), Thingies (\ref{fig:c}), Cabbages (\ref{fig:d}) and Nuclear Warheads (\ref{fig:e})%
      }\label{fig:x}%
    }{%
  \begin{subfloatrow}%
    \subfloat[Penguins were here and here and here]{%
      \includegraphics[height=.1\textheight]{example-image-a}\label{fig:a}}
    \qquad
    \subfloat[Penguin]{%
      \includegraphics[height=.15\textheight]{example-image-b}\label{fig:b}}
    \qquad
    \subfloat[Penguin]{%
      \includegraphics[height=.125\textheight]{example-image-a}\label{fig:c}}
  \end{subfloatrow}

  \begin{subfloatrow}
    \subfloat[Penguin]{%
      \includegraphics[height=.15\textheight]{example-image-b}\label{fig:d}}
    \qquad
    \subfloat[Penguins were here, there and everywhere!]{%
      \includegraphics[height=.2\textheight]{example-image-a}\label{fig:e}}
  \end{subfloatrow}}
\end{figure}

\end{document}

なお、 の代替手段があることは承知していますsubfig。 の解決策がない場合はsubfig、とりあえず何かをハックして、将来に向けて他のオプションを検討します。

答え1

アップデート

subfloatrowsep,キーfloatrowsepは、floatrow を使用する際にサブフロート (フロート) 間の水平方向の間隔を制御できます。ただし、次のように単純に使用しても

\thisfloatsetup{subfloatrowsep=qquad}

現在のコードではない\subfloat(パッケージから)を使用しているため、望ましい結果が得られますsubfig。解決策は、使用せずに\subfloat、代わりに を使用することfloatrowです\ffigbox。これにより、

\thisfloatsetup{subfloatrowsep=qquad}

期待通りに動作し、カウンターの問題も解決します(詳細はsubfig と floatrow を使用してサブ図の正しいラベル付けを行うにはどうすればよいでしょうか?)。

\documentclass{article}
\usepackage{graphicx,subfig}
\usepackage[heightadjust=all,valign=c]{floatrow}
\usepackage{fr-subfig}

\begin{document}

  \thisfloatsetup{subfloatrowsep=qquad}
  \begin{figure}[!htbp]
    \captionsetup[subfigure]{justification=centering}
      \ffigbox{%
  \begin{subfloatrow}[3]%
    \ffigbox[\FBwidth]{\caption{Penguins were here and here and here}\label{fig:a}}{%
      \includegraphics[height=.1\textheight]{example-image-a}}
    \ffigbox[\FBwidth]{\caption{Penguin}\label{fig:b}}{%
      \includegraphics[height=.15\textheight]{example-image-b}}
    \ffigbox[\FBwidth]{\caption{Penguin}\label{fig:c}}{%
      \includegraphics[height=.125\textheight]{example-image-a}}
  \end{subfloatrow}

  \begin{subfloatrow}
    \ffigbox[\FBwidth]{\caption{Penguin}\label{fig:d}}{%
      \includegraphics[height=.15\textheight]{example-image-b}}
    \ffigbox[\FBwidth]{\caption{Penguins were here, there and everywhere!}\label{fig:e}}{%
      \includegraphics[height=.2\textheight]{example-image-a}}
  \end{subfloatrow}%
      }{%
        \caption{Components of the system: Penguins (\ref{fig:a}), Jumpers (\ref{fig:b}), Thingies (\ref{fig:c}), Cabbages (\ref{fig:d}) and Nuclear Warheads (\ref{fig:e})\label{fig:x}}%
    }
\end{figure}

\end{document}

出力:

ここに画像の説明を入力してください

初期バージョン

floatrowまた、 とキーを使用した数字の水平方向の配置にも問題がありfloatrowsepsubfloatrowsepキーが必ずしも期待どおりに動作しないようです。

問題のあるケースで機能することがわかった 1 つのオプションは、 でデフォルトの間隔を無効にしsubfloatrowsep=none、 または\quadその他の間隔コマンドを使用して間隔を手動で制御することです (自動的に処理されると思われるかもしれませんsubfloatrowsep=quadが、必ずしもそうとは限りません)。とにかく、私の提案は次のとおりです。

\documentclass{article}
\usepackage{graphicx,subfig}
\usepackage[heightadjust=all,valign=c]{floatrow}
\usepackage{fr-subfig}

\begin{document}
  \thisfloatsetup{subfloatrowsep=none}
  \begin{figure}[!htbp]
    \captionsetup[subfigure]{justification=centering}
    \floatbox{figure}{%
      \caption{%
        Components of the system: Penguins (\ref{fig:a}), Jumpers (\ref{fig:b}), Thingies (\ref{fig:c}), Cabbages (\ref{fig:d}) and Nuclear Warheads (\ref{fig:e})%
      }\label{fig:x}%
    }{%
  \begin{subfloatrow}%
    \subfloat[Penguins were here and here and here]{%
      \includegraphics[height=.1\textheight]{example-image-a}\label{fig:a}}%
    \qquad
    \subfloat[Penguin]{%
      \includegraphics[height=.15\textheight]{example-image-b}\label{fig:b}}
    \qquad
    \subfloat[Penguin]{%
      \includegraphics[height=.125\textheight]{example-image-a}\label{fig:c}}
  \end{subfloatrow}

  \begin{subfloatrow}
    \subfloat[Penguin]{%
      \includegraphics[height=.15\textheight]{example-image-b}\label{fig:d}}
    \qquad
    \subfloat[Penguins were here, there and everywhere!]{%
      \includegraphics[height=.2\textheight]{example-image-a}\label{fig:e}}
  \end{subfloatrow}}
\end{figure}

\end{document}

ここに画像の説明を入力してください

関連情報