Frustration with fancyhdr

Posted by Flavius on Stack Overflow See other posts from Stack Overflow or by Flavius
Published on 2010-06-13T16:23:29Z Indexed on 2010/06/13 16:42 UTC
Read the original article Hit count: 330

Filed under:
|

Hi

I have the following tex document:

\documentclass[a4paper,11pt,oneside]{book}
\usepackage[usenames,dvipsnames]{color}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{lipsum}
\usepackage[left=2cm,top=3cm,right=1.5cm,bottom=2cm]{geometry}

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}{}}
\renewcommand{\subsectionmark}[1]{\markright{\thesubsection}{}}

\usepackage[Lenny]{fncychap}
\usepackage{thumbpdf}
\usepackage[colorlinks]{hyperref}
\setlength\marginparwidth{1cm}
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhead[LO,L]{Book template}
\fancyhead[RO,R]{\rightmark}
\fancyfoot[CO,C] {\thepage}

\begin{document}
\chapter{Chapter Intro}
\lipsum
\chapter{Chapter with subsections}
\section{section foo}
\lipsum
\subsection{subsection bar}
\lipsum
\end{document}

A sample can be viewed at http://www.mediafire.com/?0m5mnka32kj

On the top right:

  • How to make it show the chapter title if there is no section, as on page 2?
  • How to make it show the section title and nothing but the section title (no numbers, no subsections, subsubsections, etc) if there is an active section, as it's the case on page 4?

Thanks

© Stack Overflow or respective owner

Related posts about latex

Related posts about tex