# Titlesec Nested titles error

I am trying to write a class file (.cls) for my degree report following a university standard. However, when I try to edit the headings (for section, subsection or subsubsection) I get a nesting error.
This is my test program:

% !TeX program = lualatex
\documentclass[]{exjobb}

\usepackage[english]{babel}
% Title Page
\title{A testing Typographithing}
\author{Tesla Testing}

\begin{document}
\maketitle
Well this is just for testing
\begin{abstract}

text text
\end{abstract}

\section{SectionTitle}
section text

\end{document}


And this is my .cls file:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{exjobb}[2017/03/18 A class based on format requirements for degree project report at the Xbio program att Uppsala University]
\RequirePackage{titlesec}
\RequirePackage{fontspec}
\RequirePackage{parskip}
\RequirePackage{setspace}

\setmainfont{Times New Roman}
\setstretch{1.5}

\setlength{\parindent}{0pt}
\setlength{\parskip}{12pt}



Through the process of elimination I understand that the problem occurs when \titleformat is introduced, but I don't understand why.

• Welcome to TeX.SX! You need \thesection.quad. – egreg Mar 20 '17 at 10:51
• 'll add that I don't see the point for a \quad after the section number in display style. – Bernard Mar 20 '17 at 10:54
• @egreg Do you want to add an answer? – Johannes_B Mar 18 '18 at 8:06
• @Johannes_B done – egreg Mar 18 '18 at 9:25

The section number is obtained with \thesection.
\titleformat{name=\section}[display]