0

I am trying to make my chapter titles show in the document's header. I know of the \rightmark and \leftmark commands, but I wish to customize the look of the header while still showing the chapter titles. This is what I currently have. It only produces "Chapter [number]: Chapter" on every page.

\usepackage{fancyhdr}
\pagestyle{fancy}

\fancyhead{}
\fancyhead[RO,LE]{title}
\fancyhead[CO, RE]{Chapter \thechapter: \chaptername{}}
\fancyfoot{}
\fancyfoot[LE,RO]{\thepage}
\fancyfoot[CO,RE]{name}
1

Your question is not very clear but I guess you want something like this:

\documentclass{book}

\usepackage{blindtext} % <================= dummy text or dummy document

\usepackage{fancyhdr}
\pagestyle{fancy}
%\renewcommand{\chaptermark}[1]{%
  %\markboth{\chaptername\ \thechapter.\ #1}{}% <============== standard
%}
\renewcommand{\chaptermark}[1]{%
  \markboth{\chaptername\ \thechapter.\ \textit{#1}}{}%
}

\fancyhead{}
\fancyhead[RO,LE]{title}
\fancyhead[LO, RE]{\leftmark} % <========================= LO instead CO
\fancyfoot{}
\fancyfoot[LE,RO]{\thepage}
\fancyfoot[CO,RE]{name}


\begin{document}
\Blinddocument
\end{document}

With package blindtext you can generate a dummy text or document to have a look on the generated header and footer.

To get for example an italic title of chapter in the header you can redefine the \chaptermark like

\markboth{\chaptername\ \thechapter.\ \textit{#1}}{}

That means you get the text Chapter (content of chaptername), blank, chapter number (\thecapter), dot, blank, chapter titel in italic (\textit{#1}).

Please see I changed CO to LO to get the \leftmark printed left (L) instead centered (C)! Looks better imho.

With the given mwe you get the result:

resulting double page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.