Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
\newcommand\pagewithheader{
  \newgeometry{top=2cm, bottom=1.2cm, left=1.5cm, right=1.7cm}
  \renewcommand{\headrulewidth}{0.6pt}
}
\newcommand\pagewithfooter{
  \newgeometry{top=1.2cm, bottom=1cm, left=1.5cm, right=1.7cm}
  \renewcommand{\headrulewidth}{0pt}
  \fancyhf{}
  \fancyfoot[C]{\thepage}
}

\usepackage{afterpage}

\fancypagestyle{plain}{
  \pagewithfooter
  \afterpage{\pagewithheader}
}

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

\documentclass[a5paper,twoside]{book}

\usepackage{fontspec} % enagles loading of OpenType fonts
\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}
\newcommand\pagewithheader{
  \newgeometry{top=2cm, bottom=1.2cm, left=1.5cm, right=1.7cm}
  \renewcommand{\headrulewidth}{0.6pt}
}
\newcommand\pagewithfooter{
  \newgeometry{top=1.2cm, bottom=1cm, left=1.5cm, right=1.7cm}
  \renewcommand{\headrulewidth}{0pt}
  \fancyhf{}
  \fancyfoot[C]{\thepage}
}

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

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

\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.

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

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{}
\fancyhead[LO]{\leftmark}
\fancyhead[RE]{}
\fancyhead[LE,RO]{\thepage}
\pagestyle{fancy}

\renewcommand*{\chapterheadstartvskip}{\vspace{-1cm}\enlargethispage{-1cm}}

\begin{document}

\chapter{foo}

\kant[1-12]


\chapter{bar}

\kant[1-12]

\chapter{baz}

\kant[1-12]

\end{document}
share|improve this answer
    
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
1  
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
add comment

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}
share|improve this answer
1  
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.