Geometry for single page, redux

Here is a MWE:

\documentclass{article}
\usepackage{lipsum}
\usepackage[margin=1.5in]{geometry}

\begin{document}
\newgeometry{top=2in}
\lipsum[1-7]
\restoregeometry
\lipsum[1-5]

\end{document}


But lo, great sadness! What I wanted was that only the first page have the weird 2 inch top margin, and that, wherever that ends, we move on to other pages with 1.5 inch top margins.

So of course, we could try to throw a vspace*{0.5in} at the top. And look, there's nothing wrong with that hack, but it (a) doesn't actually do what I'm asking (the margins on the first page aren't actually any different; there's just a bit of extra space that makes it look like they are) and (b) doesn't work will with, e.g. the letter documentclass, since there's nowhere to put the vspace*{0.5in} command to get it to drop the date down. MWE for that:

\documentclass{letter}
\usepackage{lipsum}
\usepackage[margin=1.5in]{geometry}
\begin{document}

\vspace*{0.5in}

\begin{letter}{
Department of Stuff \\
California Institute of Things \\

\opening{Hiya!}

\lipsum[1-7]
\lipsum[1-5]

\end{letter}

\end{document}


It (weirdly) just throws an extra blank page at the start of things. Nope, I actually want something that gives different margins for the first page and none of the following pages, but which allows paragraphs to break across the change.

Of course, someone might have a hack for the letter class too. And that's great! But shouldn't there be some nice uniform solution? I imagine there will be classes where neither the \vspace*' nor the as-yet-to-be-determined-letter-class-hack work...

• For a single page, you don't really need to change the margins, you can add or remove space as needed (overlay the margins). – John Kormylo Jun 15 '16 at 20:16
• Do you mean, as well, that the page has to break normally between pages 1 and 2 (e.g., mid-paragraph breaking)? – Steven B. Segletes Jun 15 '16 at 20:19
• The \newgeometry approach of my now deleted answer will not work in your case, because it causes a new page to start and does not carry over breakable text from a prior page. – Steven B. Segletes Jun 15 '16 at 20:32
• In my opinion the letter class can be easily avoided. How about a solution that replicates your letter class behaviour without using letter? – Werner Jun 15 '16 at 20:41
• I suspect afterpage goes to great efforts not to change the margins in the middle of a paragraph. – John Kormylo Jun 15 '16 at 20:56

The first part of Werner’s answer won’t work if the sender’s address is also specified (with the \address declaration). In my opinion, it is more robust to patch the \opening command:

\documentclass[a4paper]{letter} % To avoid confusion, let me explicitly declare
% the paper size.
\usepackage[T1]{fontenc}    % Unrelated to the question, but I like it.
\usepackage[
margin=1.5in,
showframe   % For this example only.
]{geometry}
\usepackage{etoolbox}
\usepackage{lipsum}

Department of Farm Ecology\\
University of St.~Anford\\
Haga Alto, CA~94321}
\date{\today}

% The patch:
\pretocmd{\opening}{\vspace*{0.5in}}{}{}

\begin{document}

\begin{letter}{
Department of Stuff \\
California Institute of Things \\

\opening{Hiya!}

\lipsum[1-12]

\end{letter}

\end{document}


Here’s the first page of the output:

• It's just weird how \opening has to be patched in order to add space before the to and from address as well as the date. I know why, but it's just strange to specify document components in such an arbitrary way. – Werner Jun 15 '16 at 22:37
• @Werner: The implementation of the letter class is very frugal. Many years ago I tried my hand at writing a class for typesetting letters according to Italian style conventions (texdoc cdpbundl, in case you are curious), and I followed a modular approach, defining separate macros for the from and to address, the date, the (optional) subject, the salutation… – GuM Jun 16 '16 at 6:27
• This seems like a fairly robust solution; I'll have a look at the documentation for\pretocmd. I imagine this will be helpful for doing something similar on other document classes that do funny things at the top. – Shay Jun 16 '16 at 14:18
• @Shay: You’ll find \pretocmd in the documentation of the etoolbox package (just in case you didn’t know already ;-) . – GuM Jun 16 '16 at 16:54

My assumption here is that you want to use some letter-head that is already on a piece of paper...

If you really want what you're after and insist on using the letter class, then you'll have to use a hack. To replicate your output with the top margin on the first page 0.5" bigger than the rest, add \vspace*{0.5in} as part of a new \date declaration... even though you could use \today:

\documentclass{letter}
\usepackage{lipsum}
\usepackage[margin=1.5in,showframe]{geometry}
\date{\vspace*{0.5in}\today}
\begin{document}

\begin{letter}{
Department of Stuff \\
California Institute of Things \\

\opening{Hiya!}

\lipsum[1-12]

\end{letter}

\end{document}


You can easily recreate your current setup without using the letter class. The code also follows naturally from the output, making odd letter-specific constructions/macros superfluous.

Here is a similar output under article:

\documentclass{article}

\usepackage{lipsum}
\usepackage[margin=1.5in,showframe]{geometry}

\setlength{\parindent}{0pt}

\begin{document}

\thispagestyle{empty}
\vspace*{0.5in}

\mbox{}\hfill\today

\bigskip
\begin{tabular}{@{}l}
Department of Stuff \\
California Institute of Things \\
\end{tabular}

\bigskip

Hiya!

\medskip

\lipsum[1-12]

\end{document}

• The \date{\vspace*{0.5in}\today} trick is slick. – Shay Jun 16 '16 at 14:13

The flowfram package has no problem changing margins between pages. OTOH, it only defines the text area.

\documentclass{article}
\usepackage{lipsum}
\usepackage[margin=1.5in,showframe]{geometry}
\usepackage{flowfram}

\newflowframe[1]{\textwidth}{\dimexpr \textheight-0.5in}{0pt}{0pt}
\begin{document}
\lipsum[1-7]

\end{document}
`