I was going to try to answer the question: How can I change the geometry of a page on the chapter header page only, and return to normal on the next page? It didn't seem like it should be too difficult (despite the comments of some). Well, it turned out to be exceptionally difficult and very frustrating.
Using the geometry package
Using geometry, it's easy to go into a document and manually change the
margins etc. and easy to restore things. In the preamble, you simple
invoke:
\usepackage[margin=1in]{geometry}
If you want to change this temporarily, you can write:
\savegeometry{mydefaultgeometry}
\newgeometry{margin=3in}
And then later you can call:
\loadgeometry{mydefaultgeometry}
I thought the solution to OP's questions might be simply solved through
some finagling of the page shipout. I tried a number of approaches. I
tried using atbegshi, everyshi, and afterpage. All to no effect.
It's a local vs. global issue
Then I got an idea: maybe this was a problem of locally defined vs. globally defined values etc. I decided to test this out with something simple to verify:
\newcommand{\myname}{AEllett}
Here's the MWE I tried with afterpage:
\documentclass{report}
\usepackage{afterpage}
\usepackage{lipsum}
%%
\newcommand{\myname}{AEllett}
\newcommand{\mychapter}[1]{%
\chapter{#1}%
\afterpage{\renewcommand{\myname}{someone else's name}}%
}
%% loading fancy to test whether `\renewcommand` took effect globablly
\usepackage{fancyhdr}
\pagestyle{fancy}
\chead{\myname}
\begin{document}
\lipsum[1-15]
\mychapter{Hello}
\lipsum[1-15]
\end{document}
But if, for example, I wrote instead
\afterpage{\gdef\myname{someone else'sname}}
Then the desired effect occurred.
So I concluded that the OP's problem stemmed from the fact that
\afterpage{\loadgeometry{mydefaultgeometry}}
only sets the parameters for the page geometry locally, not globally. (I
tried the same experiment with the package everyshi; same conclusion.)
Manually reset values from within \afterpage
So, in order to automatically change the page geometry, I thought I could do something like:
\afterpage{\setlength{\global\oddsidemargin}{1in}%
\setlength{\global\evensidemargin}{1in}%
\setlength{\global\textwidth}{\dimexpr\paperwidth-2in\relax}%
}
But I got completely unexpected results: namely, the changes were inconsistently occurring. Here's MWE:
\documentclass{report}
\usepackage{afterpage}
\usepackage{lipsum}
\usepackage[showframe,margin=1in]{geometry}
%%
\newcommand{\myname}{AEllett}
\newcommand{\mychapter}[1]{%
\newgeometry{margin=3in}
\chapter{#1}%
\afterpage{\setlength{\global\oddsidemargin}{0in}%
\setlength{\global\evensidemargin}{0in}%
\setlength{\global\textwidth}{\dimexpr\paperwidth-2in\relax}%
%%\setlength{\global\linewidth}{\dimexpr\paperwidth-2in\relax}%
}
}
\begin{document}
\lipsum[1-15]
\mychapter{Hello}
\lipsum[1-25]
\end{document}
Something very strange is happening.
Manually setting all page dimensions
I thought maybe there was some bad
interaction between using the geometry package and my manually setting
things. So, I tried the experiment again without using the geometry
package.
MWE:
\documentclass{report}
\usepackage{afterpage}
\usepackage{lipsum}
\usepackage{showframe}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\textwidth}{6in}
%%
\newcommand{\myname}{AEllett}
\newcommand{\mychapter}[1]{%
\setlength{\oddsidemargin}{3in}
\setlength{\evensidemargin}{3in}
\setlength{\textwidth}{3in}
\chapter{#1}%
\afterpage{\setlength{\global\oddsidemargin}{0in}%
\setlength{\global\evensidemargin}{0in}%
\setlength{\global\textwidth}{\dimexpr\paperwidth-2in\relax}%
%%\setlength{\global\linewidth}{\dimexpr\paperwidth-2in\relax}%
}
}
\begin{document}
\lipsum[1-15]
\mychapter{Hello}
\lipsum[1-25]
\end{document}
What I find interesting is that I am successfully able to change the
effective left-hand side margin. But, I am not able to change the width of
the text. Uncommenting the lines for setting \linewidth doesn't make
matters any better.
Forgetting about doing anything fancy with chapters!
I decided to try to change parameters mid-document and see what happens.
MWE:
\documentclass{report}
\usepackage{afterpage}
\usepackage{lipsum}
\usepackage{showframe}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\textwidth}{6in}
%%
\begin{document}
\lipsum[1-15]
\setlength{\global\oddsidemargin}{2in}%
\setlength{\global\evensidemargin}{2in}%
\setlength{\global\textwidth}{\dimexpr\paperwidth-4in\relax}%
\lipsum[1-25]
\end{document}
I get similar results.
I do not understand what is going on here. showframe clearly believes
that the dimensions of the text width have been changed. Why doesn't
LaTeX?
If I add the following to my preamble:
\usepackage{fancyhdr}
\pagestyle{fancy}
\chead{\string\textwidth=\the\textwidth}
I can see that \textwidth has in fact been changed: and as I understand
the conversion between inches and pts, the correct values are being
displayed.
\linewidth won't let me change it!!!
I tried comparing \textwidth to \linewidth. There were discrepencies.
So I went in and manually changed \linewidth **to absolutely no avail!!!*
MWE:
\documentclass{report}
\usepackage{afterpage}
\usepackage{lipsum}
\usepackage{showframe}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\textwidth}{6in}
%%
\usepackage{fancyhdr}
\pagestyle{fancy}
\chead{\string\textwidth=\the\textwidth\hspace*{2em}\string\linewidth=\the\linewidth}
\begin{document}
\lipsum[1-15]
\setlength{\global\oddsidemargin}{2in}%
\setlength{\global\evensidemargin}{2in}%
\setlength{\global\textwidth}{\dimexpr\paperwidth-4in\relax}%
\setlength{\global\linewidth}{\dimexpr\paperwidth-4in\relax}%
%%\large\normalsize
%%\clearpage
\lipsum[1-25]
\end{document}
How is it possible to apparently have the correct \textwidth and yet not
have the correct \textwidth? Why does LaTeX ignore what I'm doing when
I'm setting \linewidth?
What am I failing to understand here?
EDIT
I just found \hsize. Setting that seems to work! Sigh! Effects are predictably ugly, but \hsize does make the necessary changes effective.
This edit might suggest that I have a solution. I guess I do. But, I don't really understand what I've done. What other parameters are there that might have be reset? Why did I have to go in and change \hsize, the only documentation I can find for it is in source2e and what I find there seems a bit obfuscatory. :*(
So, I still welcome feedback from others who understand better what I've done.
#,##, and###, for headings – block quote should be saved for block quotes. I try to avoid “here” or “this” links; if you paste a SE url, it’ll be converted to the question title automagically. And I only use code markup in question titles if it would be really confusing if I didn’t, mostly because it won’t be displayed as code anyways. – doncherry Feb 07 '13 at 06:13\globalis\global\setlength{<len>}{<len>}. You can answer things yourself on this site. We're cool like that. The community is the ultimate decider on whether something is valuable or not. But I would encourage you to write up a solution. – Werner Feb 07 '13 at 06:13\hsizeas\linewidthis set to\hsizein LaTeX.\hsizeinfo can be found in the TeXbook. – yannisl Feb 07 '13 at 07:04\linewidthis something you shouldn't do; it's automatically maintained by LaTeX to reflect the current line width (particularly useful for lists). – egreg Feb 07 '13 at 07:38\global\setlengthdoesn't work if thecalcpackage is loaded; but\setlength{\global<len>}{<len>}does. :-) – egreg Feb 07 '13 at 09:07quoteenvironment can provide some help – wasteofspace Feb 07 '13 at 10:21