0

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]
\LoadClass{article}
\RequirePackage{titlesec}
\RequirePackage{fontspec}
\RequirePackage{parskip}
\RequirePackage{setspace}



%% Set bread text options
\setmainfont{Times New Roman}
\setstretch{1.5}

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


%%%Set Header 1 options
\newfontface\headingfont{Arial}
%\titlelabel{\section.\quad}
\titleformat{name=\section}[display]{\Large\headingfont}{\section.\quad}{0em}{}{}

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

4
  • 2
    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
1

The section number is obtained with \thesection.

\titleformat{name=\section}[display]
  {\Large\headingfont}
  {\thesection.\quad}
  {0em}
  {}
  {}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.