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 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?

share|improve this question
How do you use this exactly? Does it start a new paragraph, i.e. is there a empty line before it? – Martin Scharrer Apr 18 '11 at 15:27
@Martin Scharrer The picture has exactly the size of a whole page. So there is no paragraph. – RoflcoptrException Apr 18 '11 at 15:28
The size doesn't matter. There might be a paragraph nonetheless. – Martin Scharrer 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. – RoflcoptrException Apr 18 '11 at 15:34
up vote 4 down vote accepted

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.

share|improve this answer
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}} ? ´ – RoflcoptrException Apr 18 '11 at 15:30
@Roflcoptr: I fixed it. The * caused the troubles. They are not required anyway. – Martin Scharrer Apr 18 '11 at 15:34
Thanks this works like a charm! – RoflcoptrException Apr 18 '11 at 15:37

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






share|improve this answer
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. – Martin Scharrer Apr 18 '11 at 15:36

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.