# Remove section number but still keep in ToC and header

I want to remove the section numbering and then number subsections independently, resetting every chapter.

Pictorially,

1 Chapter
First section
1.1 subsection
1.2 subsection
Second section
1.3 subsection
2 Chapter
First section
2.1 subsection
...


If I do

\section*{Sectionname}


then I almost get what I want. However, the section name no longer appears as a fancyheader.

I am using the following code to create the headers:

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyfoot{}
\fancyhf{}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}


Could someone help?

• If all your sections are unnumbered, why not load titlesec and format sections so they're considered as ‘normal’?sections, but no number is displayed? – Bernard Apr 18 '18 at 9:01
• Thank you! I like your clean solution, but as you say, the solution below is a bit more flexible. – Adam Gosztolai Apr 18 '18 at 9:18

The easiest* way is to add \markright{Sectionname} to all of your sections. For this MWE, I defined a macro \mysection to execute the then three macros per section:

\documentclass{book}
\usepackage{lipsum}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyfoot{}
\fancyhf{}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}

\newcommand{\mysection}[1]{%
\section*{#1}%
\markright{#1}%
}
\renewcommand{\thesubsection}{\arabic{chapter}.\arabic{subsection}}

\begin{document}

\tableofcontents

\chapter{First Chapter}
\lipsum[1-2]
\mysection{First Section}
\lipsum[2-3]
\subsection{First Subsection}
\lipsum[3-4]
\subsection{Second Subsection}
\lipsum[4-5]
\mysection{Second Section}
\lipsum[5-6]
\subsection{Third Subsection}
\lipsum[6-7]
\chapter{Second Chapter}
\lipsum[7-8]
\mysection{Third Section}
\lipsum[8-9]
\subsection{Fourth Subsection}
\lipsum[9-10]

\end{document}


Section name in headings:

Footnote: This is "easy" in the sense that it changes the structure of your approach minimally. A solution with titlesec will probably be "easier" in the sense that once the configuration has been done, changing the appearance or adding new sections becomes really easy.

With a KOMA-Script class (as in your question here) you can use \addsec:

\documentclass{scrbook}
\usepackage{lipsum}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyfoot{}
\fancyhf{}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}

\RedeclareSectionCommand[
counterwithout=section,
counterwithin=chapter
]{subsection}

\begin{document}
\tableofcontents
\chapter{First Chapter}
\lipsum[1-2]
\lipsum[2-3]
\subsection{First Subsection}
\lipsum[3-4]
\subsection{Second Subsection}
\lipsum[4-5]
\lipsum[5-6]
\subsection{Third Subsection}
\lipsum[6-7]
\chapter{Second Chapter}
\lipsum[7-8]
\lipsum[8-9]
\subsection{Fourth Subsection}
\lipsum[9-10]
\end{document}


But then it is also recommended to use package scrlayer-scrpage for header and footer:

\documentclass{scrbook}
\usepackage{lipsum}

\clearmainofpairofpagestyles
\renewcommand\chaptermarkformat{}

\RedeclareSectionCommand[
counterwithout=section,
counterwithin=chapter
]{subsection}

\begin{document}
\tableofcontents
\chapter{First Chapter}
\lipsum[1-2]
\lipsum[2-3]
\subsection{First Subsection}
\lipsum[3-4]
\subsection{Second Subsection}
\lipsum[4-5]