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
    Maybe: \renewcommand{\sectionmark}[1]{\markright{#1}} and \fancyhead[LO]{\bfseries\rightmark}? – esdd Dec 15 '19 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. – Davide Papapicco Dec 15 '19 at 14:27
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

| improve this answer | |

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.