# \titlesec and chapter&section missing zero error

I've looked and looked on here for a possible answer but I'm coming short. I even referenced the titlesec .pdf instructions and still no clue. I'm having an issue with my \chapter in the main body, saying it is missing a zero.

Chapter 1.
! Missing number, treated as zero.
\relax
l.39 \chapter{Spanning Tree Protocol Concepts}


Error is into my first chapter.

I'm typing my notes up and for each chapter I want to display "chapter 1" then" this is the title of the chapter" The sections i do not want numbered, that's is why I use a \section*. Any thoughts?

\documentclass{report}
\usepackage[letterpaper,margin=1in]{geometry}
%\usepackage{fancyhdr}
\usepackage{amsmath ,amsthm ,amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{lipsum}
\usepackage{tabto}
\usepackage{enumitem}
\usepackage{bookmark}
\usepackage{booktabs}
\usepackage{titlesec}
\usepackage{parskip}
%\usepackage{indentfirst} used to indent first paragraph

%%%CHAPTER FORMAT/SPACING
\titleformat{\chapter}[display] %cmd and shape
{\normalfont\LARGE\bfseries} %textformat    \typeoffont\size\ifits bold?
{Chapter \thechapter}%Label
{1pt} %seperaton from num to title name
{} %before code (blank means default)
\titlespacing{\chapter}{}{}{4pt} %cmd left margin befoe titel and after title
%%%SECTION FROMAT/SPACING
\titleformat{\section}
{\normalfont\Large\bfseries}
{\thesection}{}{}
\titlespacing{\section}{}{5pt}{5pt}
\setlist{nosep}
\setlength{\intextsep}{1pt}
\setlength{\parskip}{0pt}

\begin{document}
%\maketitle{ICND2 Note}
\part{LAN Switching}
\chapter{Spanning Tree Protocol Concepts}
\section*{Spanning Tree Protocol IEEE 802.1}%\pdfbookmark{STP}    {ch:1:sec:2}
-Prevents loops when redundant links are used\\
-STP main goals
\begin{enumerate}
\item All devices in a VLAN can send frames to all others
\item Frames do not loop around (short life)
\end{enumerate}
-Checks each interface before send and receiving to prevent loops \\
-Consist of 2 states \textbf{Forwarding} \& \textbf{Blocking}
\section*{The Need for Spanning Tree} %\\pdfbookmark{Need for STP}
/end{document}

• Welcome to TeX.SX! You're missing a length in the part {\thesection}{}{} which should be {\thesection}{1em}{} or with any length you want. – egreg Apr 18 '15 at 11:30

The command \titlespacing expects three lengths.

so they should be something like

\titlespacing{\chapter}{0pt}{0pt}{4pt}


and

\titlespacing{\section}{0pt}{5pt}{5pt}


Also you have /end{document} instead of \end{document}

I don't know what you are trying to achieve, but this is your modified MWE:

\documentclass{report}
\usepackage[letterpaper,margin=1in]{geometry}
%\usepackage{fancyhdr}
\usepackage{amsmath ,amsthm ,amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{lipsum}
\usepackage{tabto}
\usepackage{enumitem}
\usepackage{bookmark}
\usepackage{booktabs}
\usepackage{titlesec}
\usepackage{parskip}
%\usepackage{indentfirst} used to indent first paragraph

%%%CHAPTER FORMAT/SPACING
\titleformat{\chapter}[display] %cmd and shape
{\normalfont\LARGE\bfseries} %textformat    \typeoffont\size\ifits bold?
{Chapter \thechapter}%Label
{1pt} %seperaton from num to title name
{} %before code (blank means default)
\titlespacing{\chapter}{0pt}{0pt}{4pt} %cmd left margin befoe titel and after title
%%%SECTION FROMAT/SPACING
\titleformat{\section}
{\normalfont\Large\bfseries}
{\thesection}{1em}{}
\titlespacing{\section}{0pt}{5pt}{5pt}
\setlist{nosep}
\setlength{\intextsep}{1pt}
\setlength{\parskip}{0pt}

\begin{document}
%\maketitle{ICND2 Note}
\part{LAN Switching}
\chapter{Spanning Tree Protocol Concepts}
\section*{Spanning Tree Protocol IEEE 802.1}%\pdfbookmark{STP}    {ch:1:sec:2}
-Prevents loops when redundant links are used\\
-STP main goals
\begin{enumerate}
\item All devices in a VLAN can send frames to all others
\item Frames do not loop around (short life)
\end{enumerate}
-Checks each interface before send and receiving to prevent loops \\
-Consist of 2 states \textbf{Forwarding} \& \textbf{Blocking}
\section*{The Need for Spanning Tree} %\\pdfbookmark{Need for STP}
\end{document}


Output

Note that you are also missing a length in

\titleformat{\section}
{\normalfont\Large\bfseries}
{\thesection}{}{}


It should be something like

\titleformat{\section}
{\normalfont\Large\bfseries}
{\thesection}{1em}{}


You just didn't notice that because in the MWE you only have unnumbered sections.

• Thank you, I just assumed that the {} meant default values because that is what \titleformat seems to do... – Shrimpy Apr 18 '15 at 11:44

I would suggest a small improvement: your lines beginning with a hyphen have an itemize structure, so I used enumitem to format itemize with endashes. A length was missing as the 4th argument of \titleformat{\section}{…}:

\documentclass{report}
\usepackage[letterpaper,margin=1in]{geometry}
%\usepackage{fancyhdr}
\usepackage{amsmath ,amsthm ,amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{lipsum}
\usepackage{tabto}
\usepackage{enumitem}
\usepackage{bookmark}
\usepackage{booktabs}
\usepackage{titlesec}
\usepackage{parskip}
%\usepackage{indentfirst} used to indent first paragraph


\setlist[itemize, 1]{label = \textendash}

%%%CHAPTER FORMAT/SPACING
\titleformat{\chapter}[display] %cmd and shape
{\normalfont\LARGE\bfseries} %textformat \typeoffont\size\ifits bold?
{Chapter \thechapter}%Label
{1pt} %seperation from num to title name
{} %before code (blank means default)
\titlespacing{\chapter}{0pt}{0pt}{4pt} %cmd left margin befoe titel and after title
%%%SECTION FORMAT/SPACING
\titleformat{\section}
{\normalfont\Large\bfseries}
{\thesection}{0.5em}{}
\titlespacing{\section}{0pt}{5pt}{5pt}
\setlist{nosep}
\setlength{\intextsep}{1pt}
\setlength{\parskip}{0pt}

\begin{document}

%\maketitle{ICND2 Note}
\part{LAN Switching}
\chapter{Spanning Tree Protocol Concepts}
\section*{Spanning Tree Protocol IEEE 802.1}%\pdfbookmark{STP} {ch:1:sec:2}
\begin{itemize}[wide = 0pt]
\item Prevents loops when redundant links are used
\item STP main goals
\begin{enumerate}[wide = 1.9em, leftmargin=3.15em]
\item All devices in a VLAN can send frames to all others Text text text text text text text text text text text text text text text text text text text text text text
\item Frames do not loop around (short life)
\end{enumerate}
\item Checks each interface before send and receiving to prevent loops
\item Consist of 2 states \textbf{Forwarding} \& \textbf{Blocking}
\end{itemize}
\section*{The Need for Spanning Tree} %\\pdfbookmark{Need for STP}

\end{document}


• I really like the format of those dashes, is there a way to create a shortcut. I'm using this style for multiple key points. It keeps me alert that this a detail in case multiple lines occur. – Shrimpy Apr 18 '15 at 14:02
• Do you mean a shortcut that would avoid typing label=\textendash as an optional argument to the itemize environment? – Bernard Apr 18 '15 at 14:06
• Yes! I'm still new to TeX but I could not stand M\$ and fighting formatting. Seems this might take a little longer to format and write but the results are more what I want. Also, is there a way to have the lines after a \textendash to not begin prior of the - would be...like if one dash contains 3 lines of words. The bottom two lines are indented a smudge to align the text with its parent – Shrimpy Apr 18 '15 at 14:27
• You can set list parameters globally using enumitem (which you did) and adding, say, \setlist[itemize]{label=…} to your preamble. See my updated answer (and details in the doc of enumitem). – Bernard Apr 18 '15 at 14:35