4

There is an inconsistent space between the second and third subfloat in subfloatrows. I don't understand where it comes from and how to remove it. (OMFSM, MWEs can take a really long time to assemble!)

\documentclass{memoir}

\usepackage{mwe}
\usepackage{duckuments}
\usepackage{caption}
\usepackage{subcaption}

\usepackage{floatrow}

%% http://texblog.org/2014/12/04/continuous-figuretable-numbering-in-latex/
%% functionality from chngcntr included in memoir class
\counterwithout{figure}{chapter}
\counterwithout{section}{chapter}

\usepackage{cleveref}

\begin{document}

\blindduck

\newcommand{\figh}{21mm}
\begin{figure}[h]
    \centering     %% centering the subfloatrow doesn't work.
    \RawFloats     %% without it, no main caption. No idea why.
    \begin{subfloatrow}
        \ffigbox[\FBwidth]{%
            \subcaption{sf1}\label{fig:sf1}
        }{%
            \includegraphics[height=\figh]{example-image-10x16}
        }%
        \ffigbox[\FBwidth]{%
            \subcaption{sf2}\label{fig:sf2}
        }{%
            \includegraphics[height=\figh]{example-image-9x16}
        }%
        \ffigbox[\FBwidth]{%
            \subcaption{sf3}\label{fig:sf3}
        }{%
            \includegraphics[height=\figh]{example-image-golden-upright}
        }%
        \ffigbox[\FBwidth]{%
            \subcaption{sf4}\label{fig:sf4}
        }{%
            \includegraphics[height=\figh]{example-image-1x1}
        }%
        \ffigbox[\FBwidth]{%
            \subcaption{sf5}\label{fig:sf5}
        }{%
            \includegraphics[height=\figh]{example-image-a4}
        }%
    \end{subfloatrow}
    \caption{A long caption. Six different images included in the \textsc{mwe} package: \cref{fig:sf1} a 10 by 16 image, \cref{fig:sf2} a 9 by 16 image, \cref{fig:sf3} an image with the golden ratio, \cref{fig:sf4} an example square, \cref{fig:sf5} a downscaled image of an A4 page.}
\end{figure}

\blindduck

\end{document}

enter image description here

  • The floatrow package is not compatible with memoir – egreg Nov 30 '18 at 18:30
  • I throws warnings alright. I shall restate my question, then. Does memoir support such a feature as rescaling images of different height to the same height and align them one next to the other? Never mind answering that in a comment. I will form a new question. – thymaro Nov 30 '18 at 18:34
  • 1
    You can simply use \subcaptionbox – egreg Nov 30 '18 at 18:41
  • @egreg thx for the hint. I will research what it does and how to use it. – thymaro Nov 30 '18 at 20:00
3

I'm inclined to think of a bug in floatrow. If I remove the first subfloat, the wrong space is again between the remaining second and third ones. The behavior repeats when commenting out the new first item:

enter image description here

Note that there is no space when the spurious ones you have in the code are removed: the correct input should be

    \ffigbox[\FBwidth]{%
        \subcaption{sf1}\label{fig:sf1}% <--- HERE
    }{%
        \includegraphics[height=\figh]{example-image-10x16}% <--- HERE
    }

and similarly for the others.

I think you're better served with subcaption tools, taking also into account that loading floatrow in memoir raises an error. The bug doesn't depend on the class and the behavior is exactly the same with book.

\documentclass{memoir}

\usepackage{duckuments}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{cleveref}

%% http://texblog.org/2014/12/04/continuous-figuretable-numbering-in-latex/
%% functionality from chngcntr included in memoir class
\counterwithout{figure}{chapter}
\counterwithout{section}{chapter}

\begin{document}

\blindduck

\begin{figure}[h]

\newcommand{\figh}{21mm}

\centering     %% centering the subfloatrow doesn't work.

\subcaptionbox{sf1\label{fig:sf1}}{%
  \includegraphics[height=\figh]{example-image-10x16}%
}\qquad
\subcaptionbox{sf2\label{fig:sf2}}{%
  \includegraphics[height=\figh]{example-image-9x16}%
}\qquad
\subcaptionbox{sf3\label{fig:sf3}}{%
  \includegraphics[height=\figh]{example-image-golden-upright}%
}\qquad
\subcaptionbox{sf4\label{fig:sf4}}{%
  \includegraphics[height=\figh]{example-image-1x1}%
}\qquad
\subcaptionbox{sf5\label{fig:sf5}}{%
  \includegraphics[height=\figh]{example-image-a4}
}

\caption{A long caption. Six different images included in the 
  \textsc{mwe} package: \cref{fig:sf1} a 10 by 16 image, \cref{fig:sf2} 
  a 9 by 16 image, \cref{fig:sf3} an image with the golden ratio, 
  \cref{fig:sf4} an example square, \cref{fig:sf5} a downscaled 
  image of an A4 page.}

\end{figure}

\blindduck

\end{document}

enter image description here

  • as every so often: tested and approved! – thymaro Dec 2 '18 at 18:06

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.