Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
@dustin: In the end this will end up in a template were I won't pick the margins, besides wouldn't the original issue reamin that the 2 figures side by side extend slightly further than the text? –  ted Jul 27 '13 at 17:54
    
\Xhsize comes from the floatrow package. It tells you how much you have left on that floatrow. In the beginning I take half the width since I have the entire row. After placing the first picture I have used half the page therefore \Xhsize is now '\linewidth'-half a page = half a page. –  ted Jul 27 '13 at 18:04
    
Try .5\linewidth as you will see the renders will become to small. (Must be with the floatrow enviornment I think it uses minipages internallz or something). \XHsize is what the floatrow package offers if you want to fill a line. –  ted Jul 27 '13 at 18:22
    
So I have a tried adjusting the geometry and making the figures small, but it will still do that no matter what the size of the figures or margins. –  dustin Jul 27 '13 at 18:36

1 Answer 1

up vote 5 down vote accepted

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

share|improve this answer
    
Fair enough, but I am slightly disappointed considering that it works perfectly without subfloatrow... –  ted Jul 29 '13 at 22:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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