子浮动间距问题:为什么会有差异?

子浮动间距问题:为什么会有差异?

我在带框的框内使用图形环境时遇到了间距问题。该图形每行有两个子浮点数,如下面的 MWE 所示:

\RequirePackage[l2tabu,orthodox]{nag}
\documentclass[11pt,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[nomath]{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usepackage{microtype,textcomp}
\usepackage[total={6.25in,10in},left=1.25in,top=0.5in,includehead,includefoot]{geometry}
\usepackage{float}
\usepackage{graphicx}
\usepackage{subfig}
\captionsetup{figurename=Figure,margin=1in,format=hang,font=small,format=plain,labelfont={bf,up},textfont={up}}
\captionsetup[subfigure]{margin=0cm,font=small,format=plain,labelfont={up},textfont={up}}
\usepackage[dvipsnames,table]{xcolor}
\usepackage{mdframed}

\begin{document}

\begin{mdframed}[
    frametitle={This one box isn't right!},
    frametitlealignment=\centering,
    frametitlefont=\sffamily,
    frametitlerule=true,
    frametitlebackgroundcolor=gray!20,
    linecolor=black,
    backgroundcolor=white,
    linewidth=0.5pt,
    leftmargin=0cm,
    rightmargin=0cm,
    topline=true,
    bottomline=true,
    innertopmargin=1ex,
    shadow=true,
    shadowsize=1.5pt,
    shadowcolor=gray!30
]

\smallskip

Blablabla blabla bla.  Blablabla blabla bla.  Blablabla blabla bla.  Blablabla blabla bla.  Blablabla blabla bla.  Blablabla blabla bla.  Blablabla blabla bla.  

    \begin{figure}[H]
        \centering
        \subfloat[Une balle lancée verticalement vers le haut.]{\includegraphics[width=7cm,height=4.25cm]{example-image}}
        \hfill
        \subfloat[A short one line description.]{\includegraphics[width=7cm,height=4.25cm]{example-image-a}}
        \\
        \subfloat[A short one line description.]{\includegraphics[width=7cm,height=4.25cm]{example-image-b}}
        \hfill
        \subfloat[Un bloc glissant vers le bas d'un plan incliné.]{\includegraphics[width=7cm,height=4.25cm]{example-image-c}}
        \\
        \subfloat[A short one line description.]{\includegraphics[width=7cm,height=4.25cm]{example-image-a}}
        \hfill
        \subfloat[A short one line description.]{\includegraphics[width=7cm,height=4.25cm]{example-image-b}}
        \\
        \subfloat[A short one line description.]{\includegraphics[width=7cm,height=4.25cm]{example-image-c}}
        \hfill
        \subfloat[A short one line description.]{\includegraphics[width=7cm,height=4.25cm]{example-image}}
        %\caption{description}
    \end{figure}

\end{mdframed}

% Why the next similar code works?  Notice the different code formatting:

\newpage
\begin{mdframed}[
    frametitle={This one box has the proper look, but why the first one doesn't?},
    frametitlealignment=\centering,
    frametitlefont=\sffamily,
    frametitlerule=true,
    frametitlebackgroundcolor=gray!20,
    linecolor=black,
    backgroundcolor=white,
    linewidth=0.5pt,
    leftmargin=0cm,
    rightmargin=0cm,
    topline=true,
    bottomline=true,
    innertopmargin=1ex,
    shadow=true,
    shadowsize=1.5pt,
    shadowcolor=gray!30
]

\smallskip

Blablabla blabla bla.  Blablabla blabla bla.  Blablabla blabla bla.  Blablabla blabla bla.  Blablabla blabla bla.  Blablabla blabla bla.  Blablabla blabla bla.  

    % DEUX FIGURES ALIGNÉES :
    \begin{figure}[H]
        \centering
        \subfloat[Une balle lancée verticalement vers le haut.]{
            \includegraphics[width=7cm,height=4.25cm]{example-image}
            }
        \hfill
        \subfloat[A short one line description.]{
            \includegraphics[width=7cm,height=4.25cm]{example-image-a}
            }
        \\
        \subfloat[A short one line description.]{
            \includegraphics[width=7cm,height=4.25cm]{example-image-b}
            }
        \hfill
        \subfloat[Un bloc glissant vers le bas d'un plan incliné.]{
            \includegraphics[width=7cm,height=4.25cm]{example-image-c}
            }
        \\
        \subfloat[A short one line description.]{
            \includegraphics[width=7cm,height=4.25cm]{example-image-a}
            }
        \hfill
        \subfloat[A short one line description.]{
            \includegraphics[width=7cm,height=4.25cm]{example-image-b}
            }
        \\
        \subfloat[A short one line description.]{
            \includegraphics[width=7cm,height=4.25cm]{example-image-c}
            }
        \hfill
        \subfloat[A short one line description.]{
            \includegraphics[width=7cm,height=4.25cm]{example-image}
            }
        %\caption{description}
    \end{figure}

\end{mdframed}

\end{document}

第一个带框的框与子框描述存在间距问题(有些描述比图片稍大)。第二个带框的框没有明显问题,但它的代码与第一个框相同,但代码格式不同。为什么输出结果有差异?我们如何修复第一个框代码?

相关内容