1

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

4
  • 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, 2012 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, 2012 at 16:20
  • And with "chapter page" you mean the starting page of a chapter?
    – lockstep
    Nov 19, 2012 at 16:24
  • 1
    Yes, the first page of chapter does not have the header-footer style I want.
    – Aaron
    Nov 19, 2012 at 16:26

1 Answer 1

1

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}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .