# How to remove numbering from section title in header

The code below generates a section title, which is what I want, but it also includes the section number. Because it's in the header, and the header also includes the page number, this becomes somewhat confusing to the reader. How do I remove the section number while keeping the section title?

\documentclass[11pt,a4paper,twoside]{article}
\usepackage[latin1]{inputenc}
\usepackage[centering]{geometry}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{tocloft}

%for alternating title with author and page number
\fancyhf{}
\renewcommand\headrulewidth{0pt}
\fancyhead[CO]{\nouppercase\leftmark}
\fancyhead[CE]{\hdrtitle}
\fancyhead[LE,RO]{\thepage}
\pagestyle{fancy}
\title{MY TITLE}
\author{MY NAME}
\makeatletter
\let\hdrtitle\@title
\makeatother
\begin{document}

\tableofcontents
\section{Part A}
\lipsum[1-5]
\subsection{Part A1}
\lipsum[1-5]
\section{Part B}
\lipsum[1-5]
\end{document}

-
The section numbers should not be in the section title as that breaks all of latex's automatic numbering/ cross referencing schemes. Instead you should define the layout for \section and \subsection to use alpabetic numbering and to put the number after the title, or if you have no title just use \section{} and have that produce "part ..." –  David Carlisle Mar 31 '13 at 9:44
@DavidCarlisle I think AlanH means the automatic numbering for sections that by default is included in the marks when using fancyhdr. –  Gonzalo Medina Mar 31 '13 at 14:01
@GonzaloMedina yes but (in general) you should keep the automatic numbering and not have a section title like Part A that duplicates the number. –  David Carlisle Mar 31 '13 at 14:03
@DavidCarlisle Agreed; perhaps the non automatic numbering was only for the example? AlanH will tell us. –  Gonzalo Medina Mar 31 '13 at 14:19
@GonzaloMedina So what I'm referring to is the "2" in "2 Part B". It just feel it leaves room for confusion when the page number is also in the header. Does that clarify? I'm sorry I'm not very fluent with LaTeX, so I'm not entirely sure what David Carlisle is speaking of. –  AlanH Mar 31 '13 at 19:41

## 1 Answer

Redefine \sectionmark to suppress the section numbering:

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


A complete example:

\documentclass[11pt,a4paper,twoside]{article}
\usepackage[latin1]{inputenc}
\usepackage[centering]{geometry}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{tocloft}

%for alternating title with author and page number
\fancyhf{}
\renewcommand\headrulewidth{0pt}
\fancyhead[CO]{\nouppercase\leftmark}
\fancyhead[CE]{\hdrtitle}
\fancyhead[LE,RO]{\thepage}
\pagestyle{fancy}

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

\title{MY TITLE}
\author{MY NAME}
\makeatletter
\let\hdrtitle\@title
\makeatother
\begin{document}

\tableofcontents
\section{Part A}
\lipsum[1-5]
\subsection{Part A1}
\lipsum[1-5]
\section{Part B}
\lipsum[1-5]
\end{document}

-
Will suppressing the number cause any clashes or issues later on? (Meaning, is this something that isn't generally recommended?) –  AlanH Mar 31 '13 at 19:44
@AlanH No; suppressing the numbers in the headers won't be a problem. The only issue, that David and me weren't sure about, is whether you are manually numbering your sections: your example has \section{part A}, and \section{part B}; if that "A" and "B" were only there for illustrative purposes, it's OK. But if you are manually labeling your real sections in this way, that is error-prone. –  Gonzalo Medina Mar 31 '13 at 21:23
@AlanH I hope I my previous comment is clear; English is not my mother tongue... If I wasn't clear, please say so and I'll try to explain myself better. –  Gonzalo Medina Mar 31 '13 at 21:24
Well, I plan to have real titles there, but for my own knowledge of avoiding future problems, could you further explain why it would be error prone? –  AlanH Mar 31 '13 at 22:29
@AlanH Writing here in comments is cumbersome and writing code is not comfortable. Would it be OK if we use a chat room to discuss this? –  Gonzalo Medina Mar 31 '13 at 22:38