Edit: It would appear that I wasn't clear in my reasoning as to why I wanted to do this..
I would like to design a way that I can have a chapter intro page that is full width, so I can fill it up with information that is designed to only be on that page… Perhaps something like an image with a blurb under the image giving some context about the relation between the chapter topic and that image… like what many textbooks do. The actual content would only start on the next page, but those pages would have different margins, presumably for room to put margin notes.
I'm aware that I can use changepage
to temporarily change the margin of a paragraph or block on the page, but I was hoping to change the whole page at once, and change back on the next page. There would be no changing of margins mid-paragraph of text.
\documentclass[twoside]{report}
\usepackage{etoolbox}
\usepackage{lipsum}
\usepackage{geometry}
\preto{\chapter}{\newgeometry{left=.75in,right=.75in}}
\appto{\chapter}{\restoregeometry} %% <--- This line doesn't work.
\begin{document}
\lipsum
\chapter{Test}
\lipsum[1-15]
\end{document}
Using etoolbox, I can get \geometry
to run before \chapter
with the \preto
command, but \appto{\chapter}{\restoregeometry}
is not working… Is it because it doesn't work how I think it does?
Best Answer
\appto
is not the way to go.You might think you could do something like
But this won't work because the parameters are only getting set locally within
\afterpage
.But that's not the end of the story. You can go in and manually change the parameters in a global manner. It's a bit of a pain, but you can do it.
The result isn't pretty. As noted in the comments above, you cannot change the effective width of a paragraph mid-paragraph. So when a paragraph spills over from the start of a chapter, on the following page it's not formatted correctly. As best I can tell there's no nice work-around for this.
What this means is that you'll have to go into the document and manually enter
\pagebreak
before any paragraph that will spill over onto the following page where you're new page geometry is to take effect. I'm not sure this solution then really saves you any hassle. But maybe you'll feel that having to add\pagebreak
is far easier than manually resetting page dimensions.But then you might have long paragraphs, half appearing on the first page of the chapter and half appearing on the next page. That's a bit more icky to deal with, and involves more manual mucking around in the document.
That seems like potentially a lot of mucking. And to boot, I had to put in a manual page break as it was.
A couple of other notes:
I'm not so sure that using
etoolbox
to\preto
and\appto
are the way to go here. You're not really trying to change what a\chapter
does. You're trying to change the lay-out of the page on the first page of the chapter. So, I think building a wrapper around\chapter
by defining a wrapper function\mychapter
is probably a better way to go.Second point, LaTeX automatically adds
1in
to the effective left-hand margin. If you try to set\oddsidemargin
to1in
thinking you'll get a1in
left margin, you'll be rather disappointed.Finally, you might want to check out my musings about how to answer your question to get an idea of why changing
\textwidth
or\linewidth
will not effect the change to the page geometry you want.