[Tex/LaTex] How to set the new margin on the next page

fancyhdrgeometryheader-footer

I have a large footer that needs to be placed on the first page of a document. To make it fit, I've used the geometry package and increased the bottom margin.

For the header/footer manipulation, I'm using fancyhdr. How do I use \newgeometry{bottom=2cm} again on the 2nd page of the text, without using \newpage and guessing where in the text the second page starts?

Can LaTex execute commands on next page? Something like

\NextPageExecute{\newgeometry{bottom=3cm}}

would solve the problem. Here is the MWE:

\documentclass{article} 

\usepackage{xcolor}
\usepackage{lipsum}

\usepackage[left=2cm,right=2cm,top=2cm,bottom=3cm]{geometry}

% Header customization, get the reference to the last page. 
\usepackage{fancyhdr, lastpage}
\pagestyle{fancy}

% Header customization, get the reference to the last page. 
\usepackage{fancyhdr, lastpage}
% Fancy pagestyle for the rest of the document.
\pagestyle{fancy}
\lhead{My form 11/17}
\rhead{Page \thepage of \pageref{LastPage}}
% Remove the horizontal line from the header.
\renewcommand{\headrulewidth}{0pt}
% Remove everything from the footline.
\cfoot{}

\definecolor{CUSTOM}{HTML}{00529e}

% Set the header and footer style. 
\fancypagestyle{empty}{%
  \fancyhf{}% Clear header/footer
  \lhead{My form 11/17}
  \rhead{Page \thepage of \pageref{LastPage}}
  \lfoot{
    Something something. \\
    Memo text. \\ 
    Some address information. \\
    Telephone numbers. \\
  }
  \rfoot{
    \textcolor{CUSTOM}{\Huge{HUGE TEXT}}
  }
}


\begin{document}

\thispagestyle{empty}

\lipsum

\lipsum

\lipsum

\end{document}.

The first page looks like this:

enter image description here

And the second page has this unnecessarily large footer space:

enter image description here

Best Answer

The afterpage package does exactly what you are looking for. Seen as you only want the 3cm bottom margin on the first page and (for example) 2cm elsewhere, I would recommend having the default layout with 2cm and using \newgeometry on the first page only (followed by a \restoregeometry\clearpage in \afterpage):

\documentclass{article} 

\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{afterpage}

\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}% 2cm bottom (usual)

% Header customization, get the reference to the last page. 
\usepackage{fancyhdr, lastpage}
\pagestyle{fancy}

% Header customization, get the reference to the last page. 
\usepackage{fancyhdr, lastpage}
% Fancy pagestyle for the rest of the document.
\pagestyle{fancy}
\lhead{My form 11/17}
\rhead{Page \thepage of \pageref{LastPage}}
% Remove the horizontal line from the header.
\renewcommand{\headrulewidth}{0pt}
% Remove everything from the footline.
\cfoot{}

\definecolor{CUSTOM}{HTML}{00529e}

% Set the header and footer style. 
\fancypagestyle{empty}{%
  \fancyhf{}% Clear header/footer
  \lhead{My form 11/17}
  \rhead{Page \thepage of \pageref{LastPage}}
  \lfoot{
    Something something. \\
    Memo text. \\ 
    Some address information. \\
    Telephone numbers. \\
  }
  \rfoot{
    \textcolor{CUSTOM}{\Huge{HUGE TEXT}}
  }
}

\begin{document}
\newgeometry{left=2cm,right=2cm,top=2cm,bottom=3cm} % Change to 3cm bottom (temp)
\thispagestyle{empty}
\afterpage{\restoregeometry\clearpage}
% CONTENT HERE

\lipsum

\lipsum

\lipsum

\end{document}

Page 1:

page1

Page 2:

page2

Related Question