# adjustwidth inside minipage produces overfull hboxes

I'm trying to typeset paragraphs with different margin widths inside a minipage. To do this I'm using an adjustwidth environment from the changepage package. This typesets fine, but (since my adjusted width is wider than the full page width) every minipage reports an overfull hbox. This does not happen outside minipages.

An MWE:

\documentclass{article}
\usepackage{lipsum,changepage,calc}

\begin{document}
\begin{minipage}{\textwidth-0.5in}
\lipsum[1]
\lipsum[2]
\lipsum[3]
\end{minipage}
\end{document}


which gives the warning

Overfull \hbox (51.135pt too wide) in paragraph at lines 5--12


Note that if the adjusted width is less than the page width outside the minipage, there is no overfull hbox; you can see this by setting the minipage width to \textwidth-2in. If there is no minipage, however, an adjusted with wider than the page width sets just fine, with no overfull hbox warning.

Is this the intended behaviour? Whether an overfull hbox message is generated or not does not depend at all on the width of the minipage, but only on the global text width. But without a minipage, there are no overfull hboxes!

When you do a minipage, the contents is wrapped inside a \vbox (or \vtop or \vcenter, but the cases are the same), which is set to the width of the widest box in it. In this case, the widest boxes are the lines of the paragraph in adjustwidth, which are \textwidth+0.5in wide; the adjustment on the left is not taken into account, because it's obtained by an operation similar to \moveleft.

Therefore you get, as expected, an overfull by 36.135pt, exactly half an inch.

The argument to \begin{minipage} is used to set the text width in the minipage, but if you change it yourself, you'll get into these troubles.

If you really want to ignore the text spilling out, enclose the minipage in a box:

\makebox[\textwidth-0.5in][l]{\begin{minipage}{\textwidth-0.5in}
...
\end{minipage}}

• What's the difference between adjustwidth inside a minipage and adjustwidth outside, then? Is there no box around an adjustwidth outside a minipage? – gilgamec Apr 18 '16 at 12:46
• @gilgamec Yes, but there is no overfull line: the overfull message appears when you typeset the minipage, which doesn't fit in the stated line width, not when the minipage is built. – egreg Apr 18 '16 at 14:18