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 have a box that's the full width of the page. I would like to offset it back into the margin a little, but when I do that it no longer reaches the edge of the page. Is it possible to keep using a macro like \textwidth but add a constant value onto it?

\hspace{-5mm} % Go back into the margin a bit
\colorbox[gray]{0.85}{
  \parbox{\textwidth}{  % Need \textwidth + 5mm to end up in the same place
    Hello
  }
}
share|improve this question
add comment

2 Answers 2

up vote 7 down vote accepted

add

  \usepackage{calc}

then you can go

  \parbox[t]{\textwidth + 5mm}
share|improve this answer
    
Works great and very clean syntax - thanks! –  Malvineous Jul 20 '12 at 6:08
add comment

With a current pdftex you can do

\parbox{\dimexpr\textwidth+5mm\relax}{...}

\parbox doesn't know the [l] option you used.

share|improve this answer
    
That works nicely if the calc package is unavailable, thanks. I'm not sure where the [l] came from in that case but you're right, it shouldn't be there. –  Malvineous Jul 20 '12 at 6:07
add comment

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.