0

I am using the fancyhdr package in my code and the preamble looks like this

\fancyhf{}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE]{\bfseries\leftmark}
\fancyhead[LO]{\bfseries}

Question is I want to add the Section name on the header of the odd pages on the left with the title not being all in uppercase. For short, how can I change the \rightmark layout to appear not in all uppercases the same way I did for the \chaptermark? I can't access the manual for some reason, I would really appreciate any help, thanks in advance.

2
  • 2
    Maybe: \renewcommand{\sectionmark}[1]{\markright{#1}} and \fancyhead[LO]{\bfseries\rightmark}?
    – esdd
    Dec 15, 2019 at 14:20
  • Yeah sorry @esdd, I completely forgot to be specific about what I wanted to change of the default section layout? Got it right now, thanks.
    – user202367
    Dec 15, 2019 at 14:27

1 Answer 1

0

You can add

\renewcommand{\sectionmark}[1]{\markright{#1}}
\fancyhead[LO]{\bfseries\rightmark}

to the preamble. Note that both \leftmark and \rightmark are still uppercased for header entries in TOC, LOF, LOT, bibliography etc. To avoid this use \nouppercase in \fancyhead:

\fancyhead[RE]{\bfseries\nouppercase{\leftmark}}
\fancyhead[LO]{\bfseries\nouppercase{\rightmark}}

Example:

\documentclass{book}
\usepackage{blindtext}% only for dummy text
\usepackage{fancyhdr}
\fancyhf{}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}% <- added
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE]{\bfseries\nouppercase{\leftmark}}% <- changed
\fancyhead[LO]{\bfseries\nouppercase{\rightmark}}% <- changed
\begin{document}
\tableofcontents
\Blinddocument
\end{document}

Result:

enter image description here

You must log in to answer this question.