# Section titles without numbers in non-starred version

I am trying to format the section title in the memoir class, so there is no section numbers in it, and I don't want to use the \section*command because it makes it more cumbersome to make it show up in the table of contents and in the heading.

At the moment, the relevant part of my preamble looks like this:

\usepackage{titlesec}

\setcounter{secnumdepth}{0}
\setcounter{tocdepth}{3}

% CHAPTER FORMAT

\titleformat{\chapter}[hang]
{\Huge\sffamily\bfseries}
{\thechapter}
{10pt}
{\Huge}

% SECTION FORMAT

\titleformat{\section}
{\sffamily\normalsize\bfseries}
{\thesection}
{1em}
{}
\titlespacing{\section}
{0pt}
{0\parskip}
{0\parskip}
[0pt]

% SUBSECTION FORMAT

\titleformat{\subsection}
{\itshape\normalsize}
{\thesubsection}
{}
{}
\titlespacing{\subsection}
{0pt}
{0\parskip}
{-1\parskip}
[0pt]


Even though I have set the secnumdepthto 0, the numbering in the section title is still there.

Here is exactly what I want:

• Chapters, Sections and Subsections in TOC
• Numbered Chapters (Both in text and in TOC)
• Unnumbered Sections and Subsections (both in text and TOC), but without using \section*

My only problem is that I can't seem to get rid of the section numbering.

EDIT:

As requested, here comes a working example:

\documentclass[a4paper, twoside]{memoir}

\usepackage{lipsum}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

% LANGUAGE/HYPHENATION

\usepackage[english, danish]{babel}

% INDENTS AND MORE

\setlength{\baselineskip}{12pt plus 0pt minus 0pt}
\setlength{\parskip}{12pt plus 0pt minus 0pt} % Skip size after paragraph
\setlength{\parindent}{0mm} % Indent size
\usepackage{indentfirst} %

\makepsmarks{thesis}{%
\createmark{chapter}{left}{nonumber}{\@chapapp\ }{. \ }
\createmark{section}{right}{nonumber}{}{}
\createplainmark{toc}{both}{\contentsname}
\createplainmark{lof}{both}{\listfigurename}
\createplainmark{lot}{both}{\listtablename}
\createplainmark{bib}{both}{\bibname}
\createplainmark{index}{both}{\indexname}
\createplainmark{glossary}{both}{\glossaryname}
}

{\sffamily\bfseries\small\thepage}{}{\sffamily\bfseries\small\leftmark}
{\sffamily\bfseries\small\rightmark}{}{\sffamily\bfseries\small\thepage}

\pagestyle{thesis}

\aliaspagestyle{chapter}{empty} % empty page style

% FORMAT TOC + LOF + LOT

\renewcommand\printtoctitle{\Huge\sffamily\bfseries}
\renewcommand\printloftitle{\Huge\sffamily\bfseries}
\renewcommand\printlottitle{\Huge\sffamily\bfseries}

% FONTS

\renewcommand{\rmdefault}{cmr}
\renewcommand{\sfdefault}{phv}
\renewcommand{\ttdefault}{pcr}
\renewcommand\familydefault{\rmdefault}

% FORMAT CHAP, SEC, SUBSEC
\usepackage{titlesec}

\setcounter{secnumdepth}{0}
\setcounter{tocdepth}{3}

% CHAPTER FORMAT

\titleformat{\chapter}[hang]
{\Huge\sffamily\bfseries}
{\thechapter}
{1em}
{\Huge}

% SECTION FORMAT

\titleformat{\section}
{\sffamily\normalsize\bfseries}
{\thesection}
{1em}
{}
\titlespacing{\section}
{0pt}
{0\parskip}
{0\parskip}
[0pt]

% SUBSECTION FORMAT

\titleformat{\subsection}
{\itshape\normalsize}
{\thesubsection}
{}
{} % Intet linieskift efter subsection
\titlespacing{\subsection}
{0pt}
{0\parskip}
{-1\parskip}
[0pt]

\begin{document}
\selectlanguage{english}
\frontmatter
\tableofcontents
\paragraph*{Abstract}
\lipsum[1]
\mainmatter
\chapter{Test Chapter}
\lipsum[1]
\section{Test Section}
\lipsum[1]
\subsection{Test Subsection}
\lipsum
\end{document}

• I'd just stop using titlesec and use \setsecnumdepth{chapter}\maxsecnumdepth{chapter}, that is enough. I do not know what titlesec messes up. And BTW, please please always post full minimal examples, that we can copy and poste without having to add or alter them – daleif Jul 31 '14 at 15:40
• What do you use for formatting the chapter title, section title etc. then? – Christoffer Jul 31 '14 at 20:43
• Memoirs own interface of couse – daleif Jul 31 '14 at 21:07
• Thanks, it actually worked with the \setsecnumdepth{chapter}\maxsecnumdepth{chapter} command instead of the \setcounter{secnumdepth}{0}--even with the titlesec package. – Christoffer Jul 31 '14 at 21:23
• Probably because of mainmatter it resets to maxsecnumdepth, so if you do not have it It fails – daleif Jul 31 '14 at 21:41

There is not much reason to use titlesec here. Just use memoirs own interface to format the though.

But, when you want to use frontmatter and mainmatter plus want to generally change the secnumdepth, remember to use

\setsecnumdepth{chapter}
\maxsecnumdepth{chapter}


The maxsecnumdepth (bad name) is what the secnumdepth is reset to at the start of mainmatter