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.

\makeatletter
\newcounter{subsubsubsection}[subsubsection]
\def\subsubsubsectionmark#1{} % Just list the number
\def\thesubsubsubsection {\thesubsubsection.\arabic{subsubsubsection}}
\def\subsubsubsection{
\vspace{0.1in}
\@startsection
{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.

\RequirePackage[cm-default]{fontspec}
\RequirePackage{xunicode}
\RequirePackage{xltxtra}
\defaultfontfeatures{Scale=MatchLowercase}
\def\@makechapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright \sffamily
\ifnum \c@secnumdepth >\m@ne
\large \bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 10\p@
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 20\p@
}}
\def\@makeschapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright
\sffamily
\interlinepenalty\@M
\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}%
{\sffamily\large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
{-3.25ex\@plus -0.1ex \@minus -.2ex}%
{0.2ex \@plus .01ex}%
{\sffamily\normalsize\bfseries}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
{-3.25ex\@plus -0.1ex \@minus -.2ex}%
{0.2ex \@plus .01ex}%
{\sffamily\MakeUppercase\small\bfseries}}
\renewcommand\subsubsubsection{\@startsection{subsubsubsection}{4}{\z@}%
{-3.25ex\@plus -0.1ex \@minus -.2ex}%
{0.2ex \@plus .01ex}%
{\sffamily\MakeUppercase\small\bfseries}}
view raw xelatex_fonts.tex hosted with ❤ by GitHub

Then you need to set your fonts:

\setsansfont[Mapping=tex-text,Scale=1.1]{Scrawler}
\setmainfont[Mapping=tex-text,Scale=1.0]{Lucida Grande}
\setmonofont{Courier}
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.


Warning: Illegal string offset 'echo' in /home/alloy/patternweaver.com/blog/wp-content/themes/hybrid/library/extensions/custom-field-series.php on line 82