XeLaTeX Section Modifications

Back in college I was working in a group project where we produced a document which was quite large, as well as deep… and we had a need for a subsubsubsection. One of the group members, Ruslan Hristov (who was also the project leader where I worked on Skipper) cobbled together an early version of this, which I have kept since, modifying it as needed. It works as you would expect.

\def\subsubsubsectionmark#1{} % Just list the number
\def\thesubsubsubsection {\thesubsubsection.\arabic{subsubsubsection}}
{subsubsubsection} % NAME
{4} % LEVEL
{\z@} % INDENT
{-3.25ex\@plus -0.1ex \@minus -.2ex} % BEFORESKIP
{0.2ex \@plus .01ex} % AFTERSKIP
{\normalsize\bf} % STYLE
\def\l@subsubsubsection{\@dottedtocline{4}{4.8em}{4.2em}} % TOC Entry
view raw subsubsubsection.tex hosted with ❤ by GitHub

This is also an opportune time to show how I add custom fonts to all of my sections using XeLaTeX’s excellent font rendering capabilities. Much of this code is originally from Manas Tungare’s original scripts.

{\parindent \z@ \raggedright \sffamily
\ifnum \c@secnumdepth >\m@ne
\large \bfseries \@chapapp\space \thechapter
\vskip 10\p@
\Huge \bfseries #1\par\nobreak
\vskip 20\p@
{\parindent \z@ \raggedright
\Huge\bfseries #1\par\nobreak
\vskip 20\p@
\renewcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -0.1ex \@minus -.2ex}%
{0.2ex \@plus.01ex}%
{-3.25ex\@plus -0.1ex \@minus -.2ex}%
{0.2ex \@plus .01ex}%
{-3.25ex\@plus -0.1ex \@minus -.2ex}%
{0.2ex \@plus .01ex}%
{-3.25ex\@plus -0.1ex \@minus -.2ex}%
{0.2ex \@plus .01ex}%
view raw xelatex_fonts.tex hosted with ❤ by GitHub

Then you need to set your fonts:

\setmainfont[Mapping=tex-text,Scale=1.0]{Lucida Grande}
view raw font_styles.tex hosted with ❤ by GitHub

Now you have extended section depth and custom styling, and can forget you even changed anything.