# Custom geometry for a first chapter page?

On normal pages I have header and no footer. On first chapter page -- I have footer (with page number) and no header. Hence I need:

\newgeometry{top=2cm, bottom=1.2cm, left=1.5cm, right=1.7cm}


for normal pages, and

\newgeometry{top=1.2cm, bottom=2cm, left=1.5cm, right=1.7cm}


for first chapter page.

In the book document class the first chapter page is of the plain page style. I thought I could do something like:

\usepackage[top=2cm, bottom=1.2cm, left=1.5cm, right=1.7cm]{geometry}
\newgeometry{top=2cm, bottom=1.2cm, left=1.5cm, right=1.7cm}
}
\newcommand\pagewithfooter{
\newgeometry{top=1.2cm, bottom=1cm, left=1.5cm, right=1.7cm}
\fancyhf{}
\fancyfoot[C]{\thepage}
}

\usepackage{afterpage}

\fancypagestyle{plain}{
\pagewithfooter
}


But I get all links messed up and floats gone mad. I tried to build an MWE:

\documentclass[a5paper,twoside]{book}

\usepackage{polyglossia} % support for languages

% fonts:
\defaultfontfeatures{Scale=MatchLowercase,Mapping=tex-text} % without this XeLaTeX won't turn "--" into dashes
\setmainfont{Arial}
\setsansfont{Arial}
\setmonofont{DejaVu Sans Mono}

\usepackage{kantlipsum}

\usepackage[top=2cm, bottom=1.2cm, left=1.5cm, right=1.7cm]{geometry}
\newgeometry{top=2cm, bottom=1.2cm, left=1.5cm, right=1.7cm}
}
\newcommand\pagewithfooter{
\newgeometry{top=1.2cm, bottom=1cm, left=1.5cm, right=1.7cm}
\fancyhf{}
\fancyfoot[C]{\thepage}
}

\usepackage{fancyhdr}
% page style for a non-chapter pages:
\renewcommand{\rightmark}[1]{\markboth{#1}{}}
\renewcommand{\leftmark}[1]{\chaptername{}\thechapter}
\fancyhf{}
\pagestyle{fancy}

\usepackage{afterpage}
\fancypagestyle{plain}{
\pagewithfooter
}

\begin{document}

\chapter{foo}

\kant[1-12]

\chapter{bar}

\kant[1-12]

\chapter{baz}

\kant[1-12]

\end{document}


But unforunetly it works. While I have a complex document with tens of links and floats -- and it doesn't (I think because of floats).

What could it be? Perhaps somebody have a recipe to make the first chapter page to be of different geometry.

-

I would use the scrbook class, and then \chapterheadstartvskip to move the \chapter up and \enlargethispage to shorten the page. Your \leftmark and \rightmark definition are nonsense, so I change them too.

\documentclass[a5paper,twoside]{scrbook}

\usepackage{kantlipsum}
\usepackage[top=2cm, bottom=1.2cm, left=1.5cm, right=1.7cm,heightrounded]{geometry}
\usepackage{fancyhdr}

%\renewcommand{\rightmark}[1]{\markboth{#1}{}} %Nonsense
%\renewcommand{\leftmark}[1]{\chaptername{}\thechapter}%nonsense

\renewcommand\chaptermark{\markboth{\chaptername{}\thechapter}{}}
\fancyhf{}
\pagestyle{fancy}

\begin{document}

\chapter{foo}

\kant[1-12]

\chapter{bar}

\kant[1-12]

\chapter{baz}

\kant[1-12]

\end{document}

-
But in Your example I don't get the page number in the footer of the first chapter page. Not even with \fancypagestyle{plain}{ \renewcommand{\headrulewidth}{0pt} \fancyhf{} \fancyfoot[C]{\thepage} }. –  Adobe Feb 19 '13 at 12:00
The footer is outside the page. Either make bottom larger, or use a smaller footskip, e.g. footskip=0.5cm. –  Ulrike Fischer Feb 19 '13 at 12:08

There is much easier solution for that (from wikibooks)

\usepackage{titlesec}
\titlespacing*{\chapter}{0pt}{-50pt}{20pt}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}

-
Welcome to TeX.sx! Feel free to visit our TeX.SX starter guide to get the most out of the site. –  Peter Jansson May 18 '13 at 13:06