[Tex/LaTex] Too wide subfigures

floatrow

I try to place to figures side by side, as can be seen below the resulting figures are to wide, they expand over the right document border. Do I have to take the gap into account when sizing the images, and if so how do I do it, so that I don"t have to adjust if I globally change the gap size?

overset image

MWE: (Fancyhdr is used to show tha actual width of the main text area)

\documentclass{report}
\usepackage{caption}                            %we base the subfigures on this
\usepackage[list=on]{subcaption}                %we base the subfigures on this
\usepackage{floatrow}                           %subfigures
\usepackage[demo]{graphicx}
\usepackage{adjustbox}                          %limit graphics sizes

%floatrow setup
\floatsetup{style=ruled,footposition=caption,capposition=bottom, heightadjust=object}   %make graphics look like booktables
\floatsetup[table]{style=plain,footposition=bottom}
\floatsetup[subfigure]{style= plain, heightadjust=object, valign=t}
\DeclareCaptionSubType[alph]{figure}
\captionsetup[subfigure]{labelformat=brace,justification=centerlast}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{1.0pt}

\makeatletter
%\renewcommand\fps@figure{!htb}
\setlength\@fptop{0pt} 
\makeatother
\begin{document}
\begin{figure}[t]
    \centering
    \ffigbox[\FBwidth]{
    \begin{subfloatrow}
        \ffigbox[.5\Xhsize]{\caption{cap1}}{\includegraphics[width=.5\Xhsize]{}}
        \ffigbox[\Xhsize]{\caption{cap2}}{\includegraphics[width=\Xhsize, height=5cm]{}}
    \end{subfloatrow}}
    {\caption{Tile network}}
\end{figure}
\end{document}

Best Answer

You have fixed the with of \includegraphics exactly as big as \ffigbox. Probably the problem is only that the content can not be as big as the container.

Narrowing a pinch the images, for example to .45\Xhsize and .95\Xhsize, seem to solve the problem and it is even more elegant (IMHO, of course). With .499\Xhsize and .999 \Xhsize the horizontal difference between rules and image margins is almost imperceptible even zooming at 400%.

MWE