# \newgeometry is not remembered when writing a new page

I'm using the package geometry to customize my document. I specify the geometry I want using \newgeometry after a title that I will make later.

If I do that using the code below, the first page is ok, but after executing \newpage the document seems to forget the geometry I want to use for the whole document, and then this new page is not centered with respect to the first page anymore.

Is there a way to use my defined geometry with \newgeometry in the page right after \newpage?

\documentclass{book}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[a4paper]{geometry}

\usepackage{sidenotes} % Notes in the margin
\usepackage{comment}

\begin{comment}

\begin{marginfigure}
\includegraphics[width=\marginparwidth]{example-image-a}%
\caption{This is in the margin.}%
\end{marginfigure}

\end{comment}

\usepackage{graphicx}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\footrulewidth}{0.4pt}

\begin{document}
% Future title here
\newgeometry{
a4paper,
centering,
layoutwidth=20cm,
layouthoffset = -1cm,
layoutheight = 34cm,
layoutvoffset = -2.5cm
}

\setcounter{chapter}{-1}
\chapter{Basic concepts}
\thispagestyle{fancy}
\section{Multiply two numbers}

When we have to numbers $a$ and $b$ and we want to multiply them we have
$a\cdot b = c$
where $c$ is the result of multiplying $a$ and $b$
\newpage
a
\end{document}

• Do you want to use \documentclass[oneside]{book}? Book documentclass is twoside by default and may be this is what you suppose is the problem. But if you imagine the book printed then the left pages has to leave a space for notes (etc) on their left ant the right pages on their right. Is this the part you didn't realized? – koleygr Jan 19 at 19:49
• @koleygr Well, that did the trick! I will use a oneside book. But maybe is a way to fix that for the two-sided book, because in the left page there is almost no margin. – Martín Jan 19 at 20:37

If you are going to use the same geometry for the whole document, you don't need to call \newgeometry command in the biggining of the document but call \usepackage command of geometry with the options you wish to have.

Also, as mentioned in the comment, you need oneside documentclass.

So, Something like this could work for you (adjust the numbers to fit your needs):

\documentclass[a4paper,oneside]{book}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[centering,
layoutwidth=20cm,
layouthoffset = -0.5cm,
layoutheight = 34cm,
layoutvoffset = -2.5cm]{geometry}

\usepackage{sidenotes} % Notes in the margin
\usepackage{comment}

\begin{comment}

\begin{marginfigure}
\includegraphics[width=\marginparwidth]{example-image-a}%
\caption{This is in the margin.}%
\end{marginfigure}

\end{comment}

\usepackage{graphicx}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\footrulewidth}{0.4pt}

\begin{document}
% Future title here

\setcounter{chapter}{-1}
\chapter{Basic concepts}
\thispagestyle{fancy}
\section{Multiply two numbers}

When we have to numbers $a$ and $b$ and we want to multiply them we have
$a\cdot b = c$
where $c$ is the result of multiplying $a$ and $b$
\newpage
\noindent a
\end{document}