I am writing a book in which I want to customize the headers and footers for the main matter. I want it to have the following style:
- nothing to be printed in the footer - (
\fancyfoot{}
) - page number on the Even-Right and Odd-Left pages -
\fancyhead[ER,OL]{\thepage}
- book title on the even pages, close to the page number
- chapter number and chapter title on the odd pages, close to the page number (called with
\thechapter
)
I want to create a new style with:
\fancypagestyle{mainmatterstyle}{%
\fancyfoot{}
\fancyhead[ER,OL]{\thepage}
the additional commands go here
}
Can anyone address me on how to do that?
I started reading the fancyhdr
manual today and got stuck in section 15. I didn't understand the \rightmark
, \leftmark
, \markboth
and \markright
scoop.
My document has the following structure:
\documentclass{book}
\usepackage{fancyhdr}
\fancypagestyle{mainmatterstyle}{
% ⟨as above⟩
}
\title{My Book Title}
\author{Tush}
\begin{document}
\frontmatter
\maketitle
\tableofcontents
\mainmatter
\pagestyle{mainmatterstyle}
\chapter{The first chapter}
% ...Text goes here...
\end{document}
Is there a command, something like \thebooktitle
, that prints the argument of \title{}
?
\chapter
to get the chapter name, since it is the command to actually set a new chapter name.