1

\FBwidth declaration seems to work for subfigures and for parent figures only if subfigures are placed in the same row.

With subfigures in separate rows, \FBwidth for figure caption does not measure the width of the largest subfigure but the sum of all subfigures' width.

Is there a way to apply wrap to the figure's caption as well?

\documentclass{article}

    \usepackage{subfig}
    \usepackage{floatrow}
    \usepackage[top=1cm,bottom=1cm,left=1cm, right=1cm]{geometry}

    % For demo only
    \usepackage[demo]{graphicx}


\begin{document}

    In the following example, subfigures' captions are wraped to the size of each subfigure. Global caption is wraped to the size of both figures.

    \begin{figure}[h]
        \centering
        \ffigbox[\FBwidth]{
            \begin{subfloatrow}[2]

                \ffigbox[\FBwidth]{
                    \caption{A very very very very very very very very
                        very very very very long subcaption}
                }
                {
                    \includegraphics[width=4cm,height=4cm]{image1}
                }

                \ffigbox[\FBwidth]{
                    \caption{A very very very very very very very very
                        very very very very long subcaption that is even
                        longer than the first}
                }
                {
                    \includegraphics[width=4cm,height=3cm]{image1}
                }


            \end{subfloatrow}

        }
        {
            \caption{And here's the caption to the main figure that
                seems to be working ok}
            \label{tournaments}
        }
    \end{figure}

Unfortunately, if subfigures are place on separate rows, the global caption wraps as if they were in the same row.

        \begin{figure}[h]
        \centering
        \ffigbox[\FBwidth]{
            \begin{subfloatrow}[1]

                \ffigbox[\FBwidth]{
                    \caption{A very very very very very very very very
                        very very very very long subcaption}
                }
                {
                    \includegraphics[width=4cm,height=3cm]{image1}
                }
            \end{subfloatrow}

            \begin{subfloatrow}[1]
                \ffigbox[\FBwidth]{
                    \caption{A very very very very very very very very
                        very very very very long subcaption that is even
                        longer than the first}
                }
                {
                    \includegraphics[width=4cm,height=3cm]{image1}
                }


            \end{subfloatrow}

        }
        {
            \caption{And here's the caption to the main figure that
                seems to be working ok}
            \label{tournaments}
        }
    \end{figure}

\end{document}

Sample

2

It should be a lot easier to do the same thing using the subfig package. However, you can adjust the width of your caption manually with \captionsetup{width=0.3\textwidth} inside the figure environment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.