0

I have defined my custom header using the fancyhdr package and this is my code:

\renewcommand{\headrulewidth}{0.1mm}
\fancyhf{}
\fancyhead[RO]{\slshape\rmfamily\nouppercase\rightmark}
\fancyhead[LE]{\slshape\rmfamily\thechapter\ \nouppercase\leftmark}
\fancyfoot[RO, LE]{\thepage}

And I redefine the plain style with this:

\fancypagestyle{plain}{%
  \fancyhf{}
  \fancyfoot[RO, LE]{\thepage}
  \renewcommand{\headrulewidth}{0mm}
}

But I would remove the chapter number on the header of the TOC and the Bibliography. How can I do that?

This is a MWE:

\documentclass[twoside]{report}
\usepackage{fancyhdr}
\usepackage{lipsum}
\renewcommand{\headrulewidth}{0.1mm}
\fancyhf{}
\fancyhead[RO]{\slshape\rmfamily\nouppercase\rightmark}
\fancyhead[LE]{\slshape\rmfamily\thechapter\ \nouppercase\leftmark}
\fancyfoot[RO, LE]{\thepage}
\pagestyle{fancy}
\fancypagestyle{plain}{%
  \fancyhf{}
  \fancyfoot[RO, LE]{\thepage}
  \renewcommand{\headrulewidth}{0mm}
}

\begin{document}

\tableofcontents

\chapter{A}
\lipsum
\subsection{E}
\lipsum
\subsection{E}
\lipsum

\chapter{B}
\lipsum
\subsection{E}
\lipsum
\subsection{E}
\lipsum

\chapter{C}
\lipsum
\subsection{E}
\lipsum
\subsection{E}
\lipsum

\chapter{D}
\lipsum
\subsection{E}
\lipsum
\subsection{E}
\lipsum

\chapter{E}
\lipsum
\subsection{E}
\lipsum
\subsection{E}
\lipsum

\chapter{A}
\lipsum
\subsection{E}
\lipsum
\subsection{E}
\lipsum

\chapter{B}
\lipsum
\subsection{E}
\lipsum
\subsection{E}
\lipsum

\chapter{C}
\lipsum
\subsection{E}
\lipsum
\subsection{E}
\lipsum

\chapter{D}
\lipsum
\subsection{E}
\lipsum
\subsection{E}
\lipsum

\chapter{E}
\lipsum
\subsection{E}
\lipsum
\subsection{E}
\lipsum

\end{document}

As you can see, on the second page in the header there is the number zero near the Contents.

10
  • 1
    As always on this site you are much more likely to get help if you provide a small self contained full document that others can copy and test as is. Here we don't even know what document class you're using.
    – daleif
    Jan 14, 2022 at 8:33
  • The TOC and Bibliography normally don't have chapter numbers. So how did you get them there? Jan 14, 2022 at 8:58
  • @daleif I update the question. Now there is the example, sry Jan 14, 2022 at 9:23
  • If you're willing to switch to a different class, then this is basically the default setup in the memoir class, no fancyhdr needed. If you load memoir wiith the openany class option it is basically like report
    – daleif
    Jan 14, 2022 at 9:25
  • @daleif More than switch class, if It is possible introduce into fancyhr an exception style for TOC and Bibliography Jan 14, 2022 at 9:28

1 Answer 1

1

Use these definitions:

\fancyhead[LE]{\slshape\rmfamily\leftmark}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter\ \chaptername\ \thechapter. #1}{}}

You must log in to answer this question.

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