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.

I have 2 styles for my header and footers. This one is for 90 %of my pages, I want the section in the header. My name left in the footer and my page right:

\fancypagestyle{standard}{
\fancyhf
\fancyhead[L]{\leftmark}
\fancyfoot[L]{name}
\fancyfoot[R]{Page \thepage}
}

But I also want my name in the footer on a chapters\index\tableofcontentspage + the page should be right aligned:

\fancypagestyle{chapters\index\tableofcontents}{
\fancyhf
\fancyfoot[L]{name}
\fancyfoot[R]{Page \thepage}
}

But how do I set these settings correctly? At the moment I use the "standard" style, but my numbering on chapters is different now, and I want that to be the same on al my pages. And of course a chapter page, index page of table of contents don't need a section name in the header.

Edit:

Let me try be more clear: I want my name left aligned in the footer + the page right aligned on every page. Then on pages that are part of a chapter, I want the chapter name in the header.

Thank you so much

share|improve this question
    
I'm not sure how \leftmark uses section names in a document class that faetures chapters. In other words: Please add a minimal working example (MWE) that illustrates your problem. –  lockstep Nov 19 '12 at 16:16
1  
Euhm, I meant the chapter instead of the section. This is all the code I have, just need to find a way to apply them to the right pages... –  Aaron Nov 19 '12 at 16:20
    
And with "chapter page" you mean the starting page of a chapter? –  lockstep Nov 19 '12 at 16:24
1  
Yes, the first page of chapter does not have the header-footer style I want. –  Aaron Nov 19 '12 at 16:26

1 Answer 1

up vote 1 down vote accepted

Instead of creating two new page styles, simply redefine a) the fancy pagestyle and b) the plain pagestyle which by default is used for the starting pages of chapters.

\documentclass{book}

\usepackage{makeidx}
\makeindex

\usepackage{fancyhdr}
\pagestyle{fancy}

% The following redefines the `fancy` pagestyle
\fancyhf{}
\fancyhead[L]{\leftmark}
\fancyfoot[L]{name}
\fancyfoot[R]{Page \thepage}

% And now for the `plain` pagestyle
\fancypagestyle{plain}{%
  \fancyhf{}%
  \fancyfoot[L]{name}%
  \fancyfoot[R]{Page \thepage}%
  \renewcommand*{\headrulewidth}{0pt}%
}

% \usepackage{emptypage}% optional

\usepackage{lipsum}

\begin{document}

\tableofcontents

\cleardoublepage
\renewcommand*{\headrulewidth}{0pt}

\chapter*{Introduction}
\markboth{}{}

\lipsum[1-12]

\cleardoublepage
\renewcommand*{\headrulewidth}{0.4pt}

\chapter{foo}\index{foo}

\lipsum[1-12]

\printindex

\end{document}
share|improve this answer
1  
Thank you so much, I've been searching for this like hours... 1 small thing left: I made 1 chaper like this \chapter*{}. It still has a empty line in the header, how can I remove that? –  Aaron Nov 19 '12 at 16:40
    
@Aaron See updated answer. –  lockstep Nov 19 '12 at 16:45
1  
Epic thanks! :) –  Aaron Nov 19 '12 at 16:49

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.