图形和子图形长标题换行

图形和子图形长标题换行

\FBwidth 声明似乎仅当子图放在同一行时才适用于子图和父图。

当子图位于单独的行时,图形标题的 \FBwidth 不会测量最大子图的宽度,而是测量所有子图宽度的总和。

有没有办法将换行应用到图形的标题上?

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

样本

答案1

使用包做同样的事情应该容易得多。但是,您可以在环境中subfig手动调整标题的宽度。\captionsetup{width=0.3\textwidth}figure

相关内容