Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/indispensable.git
\usepackage{algorithm}
\usepackage{booktabs}
\usepackage{calc}
\usepackage{caption}
\usepackage{datenumber}
\usepackage{datetime}
\usepackage{environ}
\usepackage{float}
\usepackage{flafter}
\usepackage{graphicx}
\usepackage{hyphenat}
\usepackage{upquote,textcomp}
\usepackage{tocloft}
\usepackage[T1]{fontenc}
\usepackage{mathptmx}
\usepackage{parskip}
\usepackage{refcount}
\usepackage[automark,nouppercase]{scrpage2}
\usepackage{url}
\usepackage[dvipsnames,svgnames,x11names,table]{xcolor}
\usepackage{tikz}
\usepackage{titlesec}
\usetikzlibrary{backgrounds,shadows,shapes,snakes}
\usepackage{pst-grad}
\usepackage{hyperref}

% Colour definitions.
\input{colours.tex}

% Vertical spacing adjustments to the table of contents.
\setlength{\cftbeforechapskip}{1.5ex}
\setlength{\cftbeforesecskip}{0.5ex}

% Horizontal spacing adjustments to the table of contents.
\makeatletter
\renewcommand{\l@section}{\@dottedtocline{1}{1.5em}{2.6em}}
\renewcommand{\l@subsection}{\@dottedtocline{2}{4.0em}{3.6em}}
\renewcommand{\l@subsubsection}{\@dottedtocline{3}{7.4em}{4.5em}}
\makeatother

% Table colours.
\colorlet{tableheader}{zebrastripecolour!80}
\colorlet{zebra}{zebrastripecolour!5}

% Apply a gradient to the sections.
\input{sections.tex}

% Import the \corp macros.
\input{companies.tex}

% Adjust the header and footer.
\input{header-footer.tex}

\input{hypersetup-indispensable.tex}
%\input{hypersetup-wordsplit.tex}

% Change algorithm to "Listing".
\floatname{algorithm}{Listing}
\renewcommand{\algorithmname}{Listing}

% Define float style called "algorithm".
\makeatletter
\newcommand\fs@algorithm{%
  \let\@fs@capt\floatc@algorithm
  \def\@fs@pre{\hrule height.8pt depth0pt\relax}% \kern2pt removed
  \def\@fs@mid{\hrule\kern2pt}%  \kern2pt removed
  \def\@fs@post{\kern2pt\hrule\relax}%
  \let\@fs@iftopcapt\iftrue}
\makeatother

% Make the algorithm environment use the algorithm float style.
\floatstyle{algorithm}
\restylefloat{algorithm}

\DeclareCaptionFormat{algorithm}{%
  \colorbox[HTML]{A6BFF2}{%
    \parbox{\textwidth}{\hspace{0.25em}#1#2#3}%
  }
}

\captionsetup{hypcapspace=0.5\baselineskip}
\captionsetup{labelfont=bf,labelsep=endash}
\captionsetup[ruled]{labelfont=bf,labelsep=endash}
\captionsetup[algorithm]{format=algorithm}

% Make sure "Figure" appears for sub-floats.
\newcommand*{\subfigureautorefname}{\figureautorefname}

% Make the chapter include just the chapter, not the number.
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\newcommand{\ChapterTitle}{\leftmark}

% Expose the chapter number when necessary (not before the main matter).
\makeatletter
\def\ChapterNumberIfNeededEven{%
  \ifnum \value{chapter}>0 ~$ \star $ \chaptername{} \thechapter{} \fi
}
\def\ChapterNumberIfNeededOdd{%
  \ifnum \value{chapter}>0 \chaptername{} \thechapter{} $ \star $ \fi
}
\makeatother

% Centre tables.
\let\oldtable\table
\let\endoldtable\endtable
\renewenvironment{table}[1][ht]{%
  \rowcolors{2}{zebra}{white}%
  \oldtable[#1]
  \centering}%
  {\endoldtable}

% Prevent hyphens in uppercase words (such as programming constants).
\let\temptt\texttt
\renewcommand\texttt[1]{\mbox{\temptt{#1}}}

% Remove extra whitespace so that colour fills the table header.
\renewcommand{\toprule}{\specialrule{\heavyrulewidth}{\abovetopsep}{0pt}}
\renewcommand{\midrule}{\specialrule{\lightrulewidth}{0pt}{\belowrulesep}}
\renewcommand{\bottomrule}{\specialrule{\lightrulewidth}{0pt}{\belowrulesep}}

% Set the current date?
\date{}

% Allow figures to be placed near the top of the page.
\renewcommand{\topfraction}{0.85}
\renewcommand{\textfraction}{0.1}
\renewcommand{\floatpagefraction}{0.75}

% Determine if the image is too wide for the page.
\makeatletter
\def\ScaleIfNeeded{%
  \ifdim\Gin@nat@width>\linewidth
    \linewidth
  \else
    \Gin@nat@width
  \fi
}
\makeatother

% Resize figures that are too wide for the page.
\let\oldincludegraphics\includegraphics
\renewcommand\includegraphics[2][]{%
  \graphicsformat{%
    \oldincludegraphics[width=\ScaleIfNeeded,#1]{#2}%
  }%
}

% Centre graphics within non-Algorithm floats.
\let\graphicsformat\centering

% Change the background colour of algorithm boxes.
\let\oldalgorithm\algorithm
\let\endoldalgorithm\endalgorithm
\renewenvironment{algorithm}[1][htbp]{
  \let\graphicsformat\justifiedandcolored
  \oldalgorithm[#1]
}%
  {\endoldalgorithm}

% Change the background colour of the algorithm floats.
\def\justifiedandcolored#1{%
  \setlength\fboxrule{0pt}%
  \setlength\fboxsep{0pt}%
  \kern-1.6pt
  \tikz[background rectangle/.style={%
	  top color=sourcecolour!60,bottom color=white},
  tight background,
  show background rectangle] 
  \node [inner sep=0pt] (0,0) {#1};%
  \par
  \kern-1.6pt
}

% Non-breaking words (IllegalArgumentException) should not be in
% the margins.
\tolerance 1414
\hbadness 1414
\emergencystretch 1.5em
\hfuzz 0.3pt
\widowpenalty=10000
\vfuzz \hfuzz

% Prevent multiline footnotes from being split across pages.
\interfootnotelinepenalty=10000

% Allow plenty of room at the bottom (this will prevent large
% vertical gaps between enumerated items and bulleted lists).
\raggedbottom

% Use the \path command for filenames.
\newcommand*{\filename}[1]{\expandafter\path\expandafter{#1}}

% Text mark-up environments and miscellaneous macros.
\input{epigraph.tex}
\input{displayed.tex}
\input{applications.tex}
\input{filenames.tex}
\input{dedication.tex}

% Use roman numerals for second-level enumerated items.
\renewcommand{\theenumii}{\roman{enumii}}

% Flip the margins around. Even pages on the left, odd on the right,
% and the margins set up so that the crease gets lots of space.
\let\tmpmargin\oddsidemargin
\let\oddsidemargin\evensidemargin
\let\evensidemargin\tmpmargin
\reversemarginpar

% Required by LyX...
\makeatletter