Espaçamento horizontal entre subfloats usando floatrow e subfig (com suporte fr-subfig)

Espaçamento horizontal entre subfloats usando floatrow e subfig (com suporte fr-subfig)

Estou tentando organizar duas linhas de subfiguras usando subfige floatrow. As legendas estão alinhadas como desejo e o alinhamento vertical dos objetos também está bom. No entanto, não consigo descobrir como uniformizar o espaçamento horizontal entre as subfiguras. Na linha de baixo não há problema: 2 figuras com algum espaço entre elas. Multar. Na linha superior, entretanto, há mais espaço entre as duas primeiras figuras do que entre a segunda e a terceira figuras. E não consigo descobrir por quê.

5 subfiguras em 2 linhas

o que estou perdendo?

\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}

Observe que estou ciente de alternativas para subfig. Se nenhuma solução estiver disponível subfig, hackearei algo por enquanto e procurarei outras opções para o futuro.

Responder1

Atualizar

As teclas subfloatrowsep, floatrowsepfornecem controle sobre a separação horizontal entre subfloats (floats) ao usar floatrow; no entanto, simplesmente usando algo como

\thisfloatsetup{subfloatrowsep=qquad}

em seu código atual seránãoproduza o resultado desejado desde que você está usando \subfloat(da subfigembalagem). A solução não é usar \subfloate usar floatrow's \ffigbox. Isto faz

\thisfloatsetup{subfloatrowsep=qquad}

comportar-se conforme esperado e também resolve um problema com os contadores (discutido mais detalhadamente emComo posso obter a rotulagem correta de subfiguras com subfig e 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}

A saída:

insira a descrição da imagem aqui

Versão inicial

Também tive problemas com o posicionamento horizontal de figuras usando floatrowe as floatrowsepteclas subfloatrowsepparecem nem sempre se comportar conforme o esperado.

Uma opção que descobri que funciona em casos problemáticos é eliminar a separação padrão subfloatrowsep=nonee usar \quadqualquer outro comando de espaçamento para controlar manualmente a separação (alguém poderia pensar que isso subfloatrowsep=quadresolveria isso automaticamente, mas nem sempre é o caso) . De qualquer forma, minha sugestão:

\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}

insira a descrição da imagem aqui

informação relacionada