# Remove “chapter” keyword from header

The current code for my latex document is this:

\documentclass[12pt,notitlepage]{report}

\usepackage{lipsum}

\usepackage{fancyhdr}
\pagestyle{fancy}

\begin{document}

\pagenumbering{roman}

\thispagestyle{plain}
\tableofcontents
\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?

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}
\renewcommand\chaptermark[1]{\markboth{\thechapter\,--\,#1}{}}

\begin{document}

\pagenumbering{roman}

\thispagestyle{plain}
\tableofcontents
\thispagestyle{plain}

\newpage

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

\end{document}


As an alternative to fancyhdr you can use scrlayer-scrpage:

\documentclass[12pt,notitlepage]{report}

\usepackage{lipsum}

\renewcommand*{\chaptermarkformat}{\thechapter--}% Use "1–" instead of "Chapter 1 " in the chapter mark
\begin{document}

\pagenumbering{roman}

\cleardoublepage
% the first ToC page (before \tableofcontents)
\tableofcontents

\cleardoublepage% if twoside next odd page

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

\end{document}


Note: I've also removed strange \thispagestyle{plain} commands and moved the \addcontentsline command. In you example, it would add the last page of the table of contents to the table of contents, which wouldn't make sense.

As an alternative you could use package tocbibind.

However, I would recommend not to add and entry for the the table of contents into the table of contents. Mostly this doesn't make any sense.

A simple possibility is to load titleps, which comes with titlesec but can be used independently. No fiddling with marks (unless you want to…). Just \chaptertitle, \sectiontitle, &c.).

\documentclass[12pt,notitlepage]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage{titleps}

\newpagestyle{mypagestyle}{%
\setfoot{}{\thepage}{}
}%

\begin{document}

\pagenumbering{roman}

\thispagestyle{plain}
\tableofcontents