+% Fix gls in hyperlink errors
+\pdfstringdefDisableCommands{%
+ \def\acrlong#1{}%
+ \def\acrlongpl#1{}%
+ \def\acrshort#1{}%
+ \def\acrfull#1{}%
+ \def\gls#1{}%
+ \def\glspl#1{}%
+ \def\Gls#1{}%
+ \def\Glspl#1{}%
+}
+
+% Clean language spec for listings
+\lstdefinelanguage{Clean}{%
+ alsoletter={ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_`1234567890},
+ alsoletter={~!@\#$\%^\&*-+=?<>:|\\.},
+ morekeywords={generic,implementation,definition,dynamic,module,import,from,where,in,of,case,let,infix,infixr,infixl,class,instance,with,if,derive,::},
+ sensitive=true,
+ morecomment=[l]{//},
+ morecomment=[n]{/*}{*/},
+ morestring=[b]",
+ morestring=[b]',
+ emptylines=1,
+ basewidth=0.45em,
+ columns=[c]fixed,
+ texcl=true,
+ upquote=true,
+ literate=%
+ % Basic Clean constructs
+ {\\}{{$\lambda\:$}}1
+ {A.}{{$\forall\;\,$}}1
+ {E.}{{$\exists\;\,$}}1
+ {*}{{$^*$}}1
+}
+
+% Handy shortcut for inline Clean code
+\newcommand{\CI}[1]{\lstinline[language=Clean,basicstyle=\ttfamily\fontseries{l}\normalsize]|#1|}
+
+% General listings settings
+\lstset{%
+ breakatwhitespace=false,
+ breaklines=true,
+ captionpos=b,
+ keepspaces=true,
+ basicstyle=\ttfamily\fontseries{l}\footnotesize,
+ commentstyle=\slshape\fontseries{m},
+ keywordstyle=\bfseries\fontseries{b},
+ stringstyle=\ttfamily,
+ showspaces=false,
+ showstringspaces=false,
+ showtabs=false,
+ tabsize=4,
+ frame=L,
+ language=Clean
+}
+
+% Increase the depth for the table of contenst
+\setcounter{secnumdepth}{3}