% myfancybook.sty
% from http://www.jokr.de/stefan/
% File created by Stefan Krause -- version 1.3.
% Defines a fancyheader layout for a book document.
% You may redefine
%  \fancytitle
% from this document.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{myfancybook}[2009/01/29]
\RequirePackage{fancyhdr,ifthen,textcase}
\newcommand{\fancytitle}{}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\cfoot{\thepage}
\ifthenelse{\boolean{@twoside}}{
 \fancyhead[OL,ER]{\textsl{\fancytitle}}
 \fancyhead[EL]{\textsl{\leftmark}}
 \fancyhead[OR]{\textsl{\rightmark}}
}{
 \lhead{\textsl{\fancytitle}}
 \rhead{\textsl{\leftmark}}
}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{
 \if@mainmatter
  \markboth{\MakeTextUppercase{\@chapapp\ \thechapter. \ #1}}{\MakeTextUppercase{\@chapapp\ \thechapter. \ #1}}
 \else
  \markboth{\MakeTextUppercase{#1}}{\MakeTextUppercase{#1}}
 \fi
}
\renewcommand{\sectionmark}[1]{\markright{\MakeTextUppercase{\thesection. \ #1}}}
