tags:

views:

641

answers:

2
+5  A: 

I suspect your last heading box is being constructed after your text finishes making the multicol boxes, so you're out of the scope of your change. It goes back to the old value.

You'd probably do well to add the fancyhdr package and use it. I believe it's well-behaved in multicolumn.

Okay, so it's almost certainly the scope thing. You're doing the adjustwidth in your new multi environment. When your text runs out in the multi envirnment, you haven't filled the last page; headers aren't set up until the page is filled. So your mutlti environment finishes the box, you leave the scope, and THEN the page is finished and emitted. Using the old width.

Set the header width and parameters outside the environment.

Charlie Martin
This is surely the right explanation. If you don't want to use fancyhdr, you could try a \clearpage at the end of the text. That might fake it.
dmckee
The example I have exposed already uses fancyhdr. Sorry for missing to point that out.
Flavius
Once again I'd love to know what the downvote was for....
Charlie Martin
Charlie, you have 19k rep and you have to ask about drive-by downvoters?
Norman Ramsey
Well, I think it was more in the nature of a whine....
Charlie Martin
@Norman: He got 19k by caring for such details :)
Aaron Digulla
@Aaron, no, I was just whining....
Charlie Martin
+4  A: 

I ran your test document. It seems to have a bug in that \newlength{\newtextwidth} has a global effect, and so causes an error. Not sure why that is but I pulled it out of the \newenvironment{multi} with no ill effect.

Charlie's diagnosis is definitely correct. An alternative solution is to end the page after the multicols but before the adjustwidth, thus:

\newenvironment{multi}[1]{%
   ...}
{\end{multicols}\vfill\break\end{adjustwidth}}

I have tested this solution and on your sample document, it produces good output.

Norman Ramsey
I second that; changing the width of the header from inside an environment should not work; what is TeX supposed to do when you have two environments on a single page which can't agree on the width? Also, when reordering content to fill pages perfectly, an environment could end up on a different page and when the header.
Aaron Digulla