# Newgeometry in memoir, different results in different pages

I'm trying to create a document with the memoir class. The document needs to have a specific header and footer on the first page, and a different header and footer on the rest of the document.

I have tried with fancyheader but the second page is not getting it right (the text shifts up and invades the header, and the footer also shifts up).

Can anyone think of a way to do this with the headers and footers from the memoir class (without fancyheader)? The headers and footers are kind of complicated, with several lines.

This is a MWE:

\documentclass[oneside]{memoir}

\usepackage{titletoc}
\usepackage[ddmmyyyy]{datetime} % Para la fecha del informe
\usepackage{lastpage}  % Para saber cuantas paginas hay en el documento
\usepackage{fancyhdr}  % Para encabezados y pie de pagina
\usepackage{xcolor}    % Para texto de colores
\usepackage[lmargin=1.5cm,rmargin=1.5cm,top=2.5cm,bottom=3.5cm,includefoot]{geometry}  % Para fijar los margenes

\begin{document}

\fancyhf{}
\renewcommand{\today}{\the\day-\shortmonthname[\the\month]-\the\year}

\fancypagestyle{rest}{
\fancyhf{}
\begin{tabular}{l@{\hskip 0.5cm}r @{}}
& AAA-TOPSECRET\\
\ \\
Code: & AAA-CDE-ITR-019\\
Date: & \today\\
Version: & 1\ \\
Page: & \thepage\  of \pageref{LastPage}
\end{tabular}
}

\renewcommand{\footrulewidth}{0.4pt}
\lfoot{\footnotesize DER}
\rfoot{\footnotesize JHG Technical Report}
}

\fancypagestyle{titlepage}{
\fancyhf{}
\lfoot{
\begin{flushleft}
\footnotesize
\begin{tabular}{@{} l@{\hskip 0.5cm}r }
Prepared by: & John Smith\\
Approved by: & Jake Smith\\
Authorized by: & Jake Smith\\
\end{tabular}
\ \\[0.4cm]
AAA Company\\
www.testwebsite.com\\
\textcolor{lightgray}{Custom} \textcolor{blue}{e}\textcolor{lightgray}{-Solutions.}
\end{flushleft}
}
\rfoot{
\begin{flushright}
\footnotesize
\begin{tabular}{l@{\hskip 0.5cm}r @{}}
Code: & AAA-CDE-ITR-019\\
Date: & \today\\Version: & 1\ \\
\ \\
\ \\
Internal code: & AAA 24466/19 V1/19
\end{tabular}
\end{flushright}}
\cfoot{
\ \\[3.5cm]\tiny \textcolor{gray}{The information contained within this document is considered as Secret. This information should/shall not be redistributed to non-allowed employees. The receiver is allowed to access this information precisely within conditions and for the explicit purposes previously or contractually agreed between the company and the receiver of the information; observing at all times legal regulations in intellectual property, personal data protection and other legal requirements where applicable.
}
}
}

\newgeometry{lmargin=1.5cm,rmargin=1.5cm,top=2.5cm,bottom=6cm,includefoot}

\pagestyle{rest}
\thispagestyle{titlepage}
\vspace*{\fill}
\HUGE{Test Technical Report}\\[0.3cm]
\LARGE{\textcolor{blue}{PROJECT (COMPANY)}}
\vspace*{\fill}

\newpage

\restoregeometry

Page 1 text
\newpage

Page 2 text
\newpage

Page 3 text
\newpage

Page 4 text

\end{document}

• By the way, I'm using lualatex, in case it makes any difference – antlarac Nov 25 '19 at 11:02
• Unlrelated you should never use fancyhdr with memoir. Memior has its own equivalent that is much better integrated into the class. – daleif Nov 25 '19 at 11:04
• Oh, I didn't know that, I will check it out! Thank you! – antlarac Nov 25 '19 at 11:10
• I think you should describe your end goal a bit better. I'm not sure using newgeometry is the proper solution here, but I cannot figure out the details from what you have posted right now – daleif Nov 25 '19 at 11:24
• Hi, if you compile the MWE, you will notice that in the second page the footer has been shifted up, as well as the text, which now is inside the header. I just want the second page to look like the third, fourth, etc, since they use the same style – antlarac Nov 25 '19 at 11:27