2

I´m currently working on my thesis and would like to change the header with the help of fandyhdr. In order to remove CHAPTER in front of my chapter-names I used this command:

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}

It worked out, but the section-name in the header is now capitalized. I tried also to renew the command of \sectionmark, but then the chapter-name has disappeared.

Here I have a minimal example of my code:

\documentclass[12pt,twoside]{report}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm]{geometry}

\usepackage{fancyhdr}
\pagestyle{fancy}

%Remove Chapter in front of chapter-name
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}    

%Tried to de-capitalize section-name
%\renewcommand{\sectionmark}[1]{\markboth{\thechapter.\ #1}{}}

\begin{document}

\chapter{chapterOne}

\section{sectionOne}

\section{sectionTwo}

\chapter{chapterTwo}

\end{document}
2
  • Hi @nomeal and welcome to TeX-SE. Please verify if this question and answers satisfy your needs.
    – FHZ
    Commented Feb 25, 2020 at 20:12
  • Hi @FHZ, unfortunately this question doesn´t satisfy my needs, because I would like to have the chapter-name, as well as the section-name as a header.
    – nomeal
    Commented Feb 25, 2020 at 20:19

1 Answer 1

2

You should use \markright for the section, not \markboth.

\documentclass[12pt,twoside]{report}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm]{geometry}

\usepackage{fancyhdr}
\pagestyle{fancy}

%Remove Chapter in front of chapter-name
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}

%Tried to de-capitalize section-name
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}

\begin{document}

\chapter{chapterOne}

\section{sectionOne}

\section{sectionTwo}
\newpage abc\newpage abc
\chapter{chapterTwo}

\end{document}
1
  • Works perfectly, thank you very much!
    – nomeal
    Commented Feb 25, 2020 at 20:26

You must log in to answer this question.

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