[Tex/LaTex] Changing margins removes page number

margins

I've used \newgeometry \restoregeometry to change the margins of one page so I can fit two images onto it. However as a result of this, the page number for that page has disappeared. The page is still counted, as the page following that (with the restored margins) has a page number as if the page before existed.

Best Answer

The page layout is rather strict. There are certain rules in the geometry package which governs the placement of the footers, etc.

So in your case the footer disappears from the paper. This can be circumvented by adjusting the length \footskip. This length is defaulted to 30pt (use \the\footskip to print its value in the document). So what you would do is decrease it. That can be done via the option in the \newgeometry macro called footskip=<length>.

Whenever in doubt of how the pagelayout is put, add the showframe option in the preamble. This will let you easily see any mistakes or misinterpretations of the page-layout.

Here is an example:

\documentclass{article}
\usepackage{geometry}
\geometry{paperheight=5cm,paperwidth=6cm,showframe,textheight=3cm,textwidth=4cm}

\begin{document}
Hello\footnote{a}
\clearpage
% Decrease it to half its size
\newgeometry{textheight=3cm,textwidth=4cm,footskip=15pt}
Hello\footnote{b}
\clearpage
\end{document}

This will produce the following two pages:

enter image description here enter image description here