TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)

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

%floatrow setup
\floatsetup{style=ruled,footposition=caption,capposition=bottom, heightadjust=object}   %make graphics look like booktables
\floatsetup[subfigure]{style= plain, heightadjust=object, valign=t}


        \ffigbox[\Xhsize]{\caption{cap2}}{\includegraphics[width=\Xhsize, height=5cm]{}}
    {\caption{Tile network}}
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
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%.


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


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.