1

Thank you all for your time, I just began to use LaTeX and this website so forgive me if my question has already been made, but I've searched a bit and didn't found anything that works for my situation.

I'm using Sharelatex and my document class is a two-sided report. To manage the headers and the footers of my thesis I'm using the fancyhdr package; it's code in my preamble looks like this:

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyhead[RO,LE]{Title of the thesis}
\setlength{\headheight}{14.49998pt}
\fancyfoot{}
\fancyfoot[LE,RO]{\thepage}
\fancyfoot[CO,CE]{Chapter \thechapter}
\fancyfoot[LO,RE]{Edoardo Serra}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

To insert an unnumbered chapter, and in order for it to figure out in the Table of Contents, I use the following code:

\chapter*{Introduction}
\input{chapters/introduction}
\addcontentsline{toc}{chapter}{Introduction}

The problem arises when I want to insert an unnumbered chaper after a numbered one or after an appendix, because the footer of the unnumbered chaper given by the string of code \fancyfoot[CO,CE]{Chapter \thechapter} remains the one of the numbered chapter or appendix above. How can I, if possible, insert there the name of the unnumbered chapter instead?

1 Answer 1

0

You can redefine \chaptermark and use \leftmark for the footer. Then you can set the footer entry for the unnumbered chapter manually.

Example:

\documentclass[twoside]{report}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setlength{\headheight}{14.49998pt}
\renewcommand\chaptermark[1]{\markboth{\chaptername~\thechapter}{}}

\fancyhf{}
\fancyhead[RO,LE]{Title of the thesis}
\fancyfoot[LE,RO]{\thepage}
\fancyfoot[CO,CE]{\nouppercase{\leftmark}}
\fancyfoot[LO,RE]{Edoardo Serra}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

\usepackage{blindtext}
\begin{document}
\tableofcontents

\blinddocument

\chapter*{Introduction}
  \markboth{Introduction}{}% right after chapter title
  \addcontentsline{toc}{chapter}{Introduction}% right after chapter title!
\Blindtext

\blinddocument\blinddocument\blinddocument\blinddocument
\end{document}
0

You must log in to answer this question.

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