I included a graphic the following way:


Then I changed it so that a frame is drawn around the graphic:


But now, the whole graphic with the border is move 1-2 cm to the right side of the page so that is not in line with the other content. How can I change this?

  • How do you use this exactly? Does it start a new paragraph, i.e. is there a empty line before it? Apr 18 '11 at 15:27
  • @Martin Scharrer The picture has exactly the size of a whole page. So there is no paragraph. Apr 18 '11 at 15:28
  • 1
    The size doesn't matter. There might be a paragraph nonetheless. Apr 18 '11 at 15:32
  • @Martin Scharrer Yes that's true, I tried \centering for each graphic and this would work, but I think the better solution would be the code in your answer. Thanks. Apr 18 '11 at 15:34

I would add \noindent to avoid paragraph indention, which might be the case here. Also the \fbox adds some space around its content, i.e. \fboxsep on each side. I would subtract this amount from the image width to have the image including the frame exactly \textwidth wide. You could also subtract the line width of the frame as well.

  • This seems like a good idea, but unfortunately I get an exception ! Illegal unit of measure (pt inserted). <to be read again> * l.136 ...p-2*\fboxrule\relax]{questionnaire1.png}} ? ´ Apr 18 '11 at 15:30
  • @Roflcoptr: I fixed it. The * caused the troubles. They are not required anyway. Apr 18 '11 at 15:34

Depends on why it is moving. Probably you forgot \fboxsep, \fboxrule and/or \parindent.






  • 1
    Yes, \noindent\makebox[\textwidth] is probably the best thing to do. With [c] as second optional argument you can center the image even when it is wider than \textwidth when the frame is added. Apr 18 '11 at 15:36

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.