[Tex/LaTex] Remove “chapter” keyword from header

chaptersfancyhdrheader-footer

The current code for my latex document is this:

\documentclass[12pt,notitlepage]{report}

\usepackage{lipsum}  

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyhead[C]{\nouppercase{\textit \leftmark}}

\begin{document}

\pagenumbering{roman}

\thispagestyle{plain}
\tableofcontents
\addcontentsline{toc}{chapter}{Table of Contents}
\thispagestyle{plain}

\newpage

\pagenumbering{arabic}
\chapter{One}
\lipsum[2-5]


\end{document}

I want to remove the "Chapter 1." keyword from my header "Chapter 1. One" and I want it like this: "1-One". How to do it?

Best Answer

You can redefine \chaptermark as in

\renewcommand\chaptermark[1]{\markboth{\thechapter\,--\,#1}{}}

A complete example:

\documentclass[12pt,notitlepage]{report}
\usepackage{lipsum}     
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhead{}
\fancyhead[C]{\nouppercase{\textit{\leftmark}}}
\renewcommand\chaptermark[1]{\markboth{\thechapter\,--\,#1}{}}

\begin{document}

\pagenumbering{roman}

\thispagestyle{plain}
\tableofcontents
\addcontentsline{toc}{chapter}{Table of Contents}
\thispagestyle{plain}

\newpage

\pagenumbering{arabic}
\chapter{One}
\lipsum[2-5]

\end{document}

enter image description here

Related Question