使用 floatrow 和 subfig 的子浮點之間的水平間距(支援 fr-subfig)

使用 floatrow 和 subfig 的子浮點之間的水平間距(支援 fr-subfig)

subfig我正在嘗試使用和排列兩行子圖floatrow。標題按照我的意願對齊,物件的垂直對齊也很好。但是,我不知道如何使子圖之間的水平間距均勻。在底行,沒有問題:兩個數字之間有一些空間。美好的。然而,在頂行中,前兩個圖形之間的空間比第二個和第三個圖形之間的空間更大。我不明白為什麼。

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使用 floatrow 時, ,鍵floatrowsep可讓您控制子浮點(浮點)之間的水平間隔;然而,簡單地使用類似的東西

\thisfloatsetup{subfloatrowsep=qquad}

在你目前的程式碼中將不是\subfloat由於您正在使用(從包裝中) ,因此會產生所需的結果subfig。解決方案是不使用\subfloat而使用floatrow's\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,並且floatrowsep,subfloatrowsep鍵似乎並不總是按預期運行。

我發現在有問題的情況下工作的一個選項是終止預設分隔,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}

在此輸入影像描述

相關內容