Index: doc/theses/andrew_beach_MMath/cfalab.sty
===================================================================
--- doc/theses/andrew_beach_MMath/cfalab.sty	(revision 9b7167901c8850425e1387113ff19149675468f0)
+++ doc/theses/andrew_beach_MMath/cfalab.sty	(revision df24d379842de4e6374ce0ca8666830174fc6b0d)
@@ -10,7 +10,13 @@
 
 % Other packages required.
+%
+% Access to new basic LaTeX tools and other low level commands.
 \RequirePackage{etoolbox}
+% Code formatting tools and environments.
 \RequirePackage{listings}
+% Automatically adds spaces.
 \RequirePackage{xspace}
+% Improved reference tools.
+\RequirePackage[nospace]{varioref}
 
 % Symbols: All symbols are zero argument robust commands with special rules
@@ -28,7 +34,8 @@
 \newsymbolcmd\CFA{\textsf{C}\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}}
 % C++ with kerning. (No standard number support.)
-\newsymbolcmd\CPP{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}}
+\newsymbolcmd\Cpp{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}}
 
-% This is executed very early in the \begin{document} code.
+% This is executed very early in the \begin{document} code, before the
+% document's contents but after packages are loaded.
 \AtEndPreamble{
   \@ifpackageloaded{hyperref}{
@@ -36,8 +43,32 @@
     \pdfstringdefDisableCommands{
       \def\CFA{CFA}
-      \def\CPP{C++}
+      \def\Cpp{C++}
+      \def\lstinline{}
     }
   }{}
 }
+
+% \colour{<colour>}{<text>}
+% Just \colour but using the LaTeX style instead of TeX style command.
+\newcommand*\colour[2]{{\color{#1}#2}}
+
+% \code*{<code>}
+% Use the listings package to format a snipit of <code>.
+\newrobustcmd*\codeCFA[1]{\lstinline[language=CFA]{#1}}
+\newrobustcmd*\codeC[1]{\lstinline[language=C]{#1}}
+\newrobustcmd*\codeCpp[1]{\lstinline[language=C++]{#1}}
+\newrobustcmd*\codePy[1]{\lstinline[language=Python]{#1}}
+
+\lstnewenvironment{cfa}[1][]{\lstset{language=CFA}\lstset{#1}}{}
+
+% \settextunderscore{(new|old)}
+% Redefines the underscore either as a new repersentation or the old one.
+% Not that some other packages (ex. hyperref) can override this. Set it up
+% after loading them.
+\let\cfalab@textunderscore@old=\textunderscore
+\newcommand\cfalab@textunderscore@new{%
+    \leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.075ex}}}
+\newcommand\settextunderscore[1]{%
+    \renewcommand\textunderscore{\csuse{cfalab@textunderscore@#1}}}
 
 % The CFA listings language. Based off of ANCI C and including GCC extensions.
@@ -68,20 +99,75 @@
 }
 
-% \code*[<escape character>]{<code>}
-%     Use the listings package to format a snipit of <code>.
-%     The <escape character> must be a character that does not appear in
-%     <code> and defaults to a backtick.
-\newcommand*\codeC[2][\`]{\lstinline[language=C]#1#2#1}
-\newcommand*\codeCFA[2][\`]{\lstinline[language=CFA]#1#2#1}
+% common.tex Compatablity ===================================================
+% Below this line is for compatability with the old common.tex file.
 
-% \settextunderscore{(new|old)}
-%     Redefines the underscore either as a new repersentation or the old one.
-%     Not that some other packages (ex. hyperref) can override this. Set it
-%     up after loading them.
-\let\cfalab@textunderscore@old=\textunderscore
-\newcommand\cfalab@textunderscore@new{%
-    \leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.075ex}}}
-\newcommand\settextunderscore[1]{%
-    \renewcommand\textunderscore{\csuse{cfalab@textunderscore@#1}}}
+\newcommand{\CFAStyle}{%
+  \lstset{
+    columns=fullflexible,
+    % reduce line spacing and use sanserif font
+    basicstyle=\linespread{0.9}\sf,
+    % use typewriter font
+    stringstyle=\tt,
+    tabsize=5,
+    % indent code to paragraph indentation
+    %xleftmargin=\parindentlnth,
+    % Allow ASCII characters in the range 128-255.
+    extendedchars=true,
+    % This allows you to use "math mode" to insert LaTeX into the code.
+    % Use \( and \) if you need to insert math mode inside that code.
+    escapechar=\$,
+    % LaTeX math escape in CFA code $...$
+    mathescape=false,
+    keepspaces=true,
+    % do not show spaces with cup
+    showstringspaces=false,
+    % show blank lines at end of code
+    showlines=true,
+    aboveskip=4pt,                          % spacing above/below code block
+    belowskip=0pt,
+    % numbering style
+    numberstyle=\footnotesize\sf,
+    % replace/adjust listing characters that look bad in sanserif
+    literate={-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.75ex}{0.1ex}}}}1
+      {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
+      {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
+      {<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2
+      {->}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.075ex}}}\kern-0.2ex\textgreater}2,
+  }
+}
+
+\newcommand{\abbrevFont}{\textit}           % set empty for no italics
+\@ifundefined{eg}{
+\newcommand{\EG}{\abbrevFont{e}.\abbrevFont{g}.}
+\newcommand*{\eg}{%
+    \@ifnextchar{,}{\EG}%
+        {\@ifnextchar{:}{\EG}%
+            {\EG,\xspace}}%
+}}{}%
+\@ifundefined{ie}{
+\newcommand{\IE}{\abbrevFont{i}.\abbrevFont{e}.}
+\newcommand*{\ie}{%
+    \@ifnextchar{,}{\IE}%
+        {\@ifnextchar{:}{\IE}%
+            {\IE,\xspace}}%
+}}{}%
+\@ifundefined{etc}{
+\newcommand{\ETC}{\abbrevFont{etc}}
+\newcommand*{\etc}{%
+    \@ifnextchar{.}{\ETC}%
+        {\ETC.\xspace}%
+}}{}%
+\@ifundefined{etal}{
+\newcommand{\ETAL}{\abbrevFont{et}~\abbrevFont{al}}
+\newcommand*{\etal}{%
+    \@ifnextchar{.}{\protect\ETAL}%
+        {\protect\ETAL.\xspace}%
+}}{}%
+\@ifundefined{viz}{
+\newcommand{\VIZ}{\abbrevFont{viz}}
+\newcommand*{\viz}{%
+    \@ifnextchar{.}{\VIZ}%
+        {\VIZ.\xspace}%
+}}{}%
 
 \endinput
Index: doc/theses/andrew_beach_MMath/existing.tex
===================================================================
--- doc/theses/andrew_beach_MMath/existing.tex	(revision 9b7167901c8850425e1387113ff19149675468f0)
+++ doc/theses/andrew_beach_MMath/existing.tex	(revision df24d379842de4e6374ce0ca8666830174fc6b0d)
@@ -16,7 +16,7 @@
 to be defined~\cite{Moss18}.
 \begin{cfa}
-char i; int i; double i;			$\C[3.75in]{// variable overload}$
-int f(); double f();				$\C{// return overload}$
-void g( int ); void g( double );	$\C{// parameter overload}\CRT$
+char i; int i; double i;
+int f(); double f();
+void g( int ); void g( double );
 \end{cfa}
 This feature requires name mangling so the assembly symbols are unique for
Index: doc/theses/andrew_beach_MMath/features.tex
===================================================================
--- doc/theses/andrew_beach_MMath/features.tex	(revision 9b7167901c8850425e1387113ff19149675468f0)
+++ doc/theses/andrew_beach_MMath/features.tex	(revision df24d379842de4e6374ce0ca8666830174fc6b0d)
@@ -20,5 +20,5 @@
 \subparagraph{Raise}
 The raise is the starting point for exception handling. It marks the beginning
-of exception handling by \newterm{raising} an excepion, which passes it to
+of exception handling by raising an excepion, which passes it to
 the EHM.
 
@@ -235,5 +235,5 @@
 Both traits ensure a pair of types are an exception type and its virtual table
 and defines one of the two default handlers. The default handlers are used
-as fallbacks and are discussed in detail in \VRef{s:ExceptionHandling}.
+as fallbacks and are discussed in detail in \vref{s:ExceptionHandling}.
 
 However, all three of these traits can be tricky to use directly.
@@ -351,5 +351,5 @@
 for particular exception type.
 The global default termination handler performs a cancellation
-\see{\VRef{s:Cancellation}} on the current stack with the copied exception.
+(see \vref{s:Cancellation}) on the current stack with the copied exception.
 
 \subsection{Resumption}
@@ -426,4 +426,5 @@
 
 \subsubsection{Resumption Marking}
+\label{s:ResumptionMarking}
 A key difference between resumption and termination is that resumption does
 not unwind the stack. A side effect that is that when a handler is matched
Index: doc/theses/andrew_beach_MMath/future.tex
===================================================================
--- doc/theses/andrew_beach_MMath/future.tex	(revision 9b7167901c8850425e1387113ff19149675468f0)
+++ doc/theses/andrew_beach_MMath/future.tex	(revision df24d379842de4e6374ce0ca8666830174fc6b0d)
@@ -110,5 +110,5 @@
 \section{Zero-Cost Try}
 \CFA does not have zero-cost try-statements because the compiler generates C
-code rather than assembler code \see{\VPageref{p:zero-cost}}. When the compiler
+code rather than assembler code (see \vpageref{p:zero-cost}). When the compiler
 does create its own assembly (or LLVM byte-code), then zero-cost try-statements
 are possible. The downside of zero-cost try-statements is the LSDA complexity,
Index: doc/theses/andrew_beach_MMath/implement.tex
===================================================================
--- doc/theses/andrew_beach_MMath/implement.tex	(revision 9b7167901c8850425e1387113ff19149675468f0)
+++ doc/theses/andrew_beach_MMath/implement.tex	(revision df24d379842de4e6374ce0ca8666830174fc6b0d)
@@ -9,7 +9,7 @@
 % Virtual table rules. Virtual tables, the pointer to them and the cast.
 While the \CFA virtual system currently has only one public feature, virtual
-cast \see{\VPageref{p:VirtualCast}}, substantial structure is required to
-support it, and provide features for exception handling and the standard
-library.
+cast (see the virtual cast feature \vpageref{p:VirtualCast}),
+substantial structure is required to support it,
+and provide features for exception handling and the standard library.
 
 \subsection{Virtual Type}
@@ -215,5 +215,5 @@
 \subsection{libunwind Usage}
 Libunwind, accessed through @unwind.h@ on most platforms, is a C library that
-provides \CC-style stack-unwinding. Its operation is divided into two phases:
+provides \Cpp-style stack-unwinding. Its operation is divided into two phases:
 search and cleanup. The dynamic target search -- phase 1 -- is used to scan the
 stack and decide where unwinding should stop (but no unwinding occurs). The
@@ -291,5 +291,5 @@
 @_UA_FORCE_UNWIND@ specifies a forced unwind call. Forced unwind only performs
 the cleanup phase and uses a different means to decide when to stop
-\see{\VRef{s:ForcedUnwind}}.
+(see \vref{s:ForcedUnwind}).
 \end{enumerate}
 
@@ -400,5 +400,5 @@
 
 Termination exceptions use libunwind heavily because it matches the intended
-use from \CC exceptions closely. The main complication for \CFA is that the
+use from \Cpp exceptions closely. The main complication for \CFA is that the
 compiler generates C code, making it very difficult to generate the assembly to
 form the LSDA for try blocks or destructors.
@@ -509,5 +509,6 @@
 
 % Recursive Resumption Stuff:
-Search skipping \see{\VPageref{p:searchskip}}, which ignores parts of the stack
+Search skipping (see \vpageref{s:ResumptionMarking}), which ignores parts of
+the stack
 already examined, is accomplished by updating the front of the list as the
 search continues. Before the handler at a node is called the head of the list
@@ -554,5 +555,5 @@
 Cancellation also uses libunwind to do its stack traversal and unwinding,
 however it uses a different primary function @_Unwind_ForcedUnwind@. Details
-of its interface can be found in the \VRef{s:ForcedUnwind}.
+of its interface can be found in the \vref{s:ForcedUnwind}.
 
 The first step of cancellation is to find the cancelled stack and its type:
Index: doc/theses/andrew_beach_MMath/uw-ethesis.tex
===================================================================
--- doc/theses/andrew_beach_MMath/uw-ethesis.tex	(revision 9b7167901c8850425e1387113ff19149675468f0)
+++ doc/theses/andrew_beach_MMath/uw-ethesis.tex	(revision df24d379842de4e6374ce0ca8666830174fc6b0d)
@@ -66,10 +66,4 @@
 % Tip: Photographs should be cropped and compressed so as not to be too large.
 
-% To create a PDF output that is optimized for double-sided printing:
-% 1) comment-out the \documentclass statement in the preamble below, and
-%    un-comment the second \documentclass line.
-% 2) change the value assigned below to the boolean variable "PrintVersion"
-%    from "false" to "true".
-
 % ======================================================================
 %   D O C U M E N T   P R E A M B L E
@@ -87,10 +81,7 @@
 }
 
-% Some LaTeX commands I define for my own nomenclature.
-% If you have to, it's easier to make changes to nomenclature once here than
-% in a million places throughout your thesis!
-\newcommand{\package}[1]{\textbf{#1}} % package names in bold text
-\newcommand{\cmmd}[1]{\textbackslash\texttt{#1}} % command name in tt font
-\newcommand{\href}[1]{#1} % does nothing, but defines the command so the
+%
+\newcommand{\href}[1]{#1}
+% Does nothing, but defines the command so the
 % print-optimized version will ignore \href tags (redefined by hyperref pkg).
 % Anything defined here may be redefined by packages added below...
@@ -107,4 +98,6 @@
 % Adds todos (Must be included after comment.)
 \usepackage{todonotes}
+% cfa macros used in the document
+\usepackage{cfalab}
 
 % Hyperlinks make it very easy to navigate an electronic document.
@@ -208,25 +201,6 @@
 \makeglossaries
 
-% cfa macros used in the document
-%\usepackage{cfalab}
-% I'm going to bring back eventually.
-\makeatletter
-% Combines all \CC* commands:
-\newrobustcmd*\Cpp[1][\xspace]{\cfalab@Cpp#1}
-\newcommand\cfalab@Cpp{C\kern-.1em\hbox{+\kern-.25em+}}
-% Optional arguments do not work with pdf string. (Some fix-up required.)
-\pdfstringdefDisableCommands{\def\Cpp{C++}}
-
-% Wrappers for inline code snippits.
-\newrobustcmd*\codeCFA[1]{\lstinline[language=CFA]{#1}}
-\newrobustcmd*\codeC[1]{\lstinline[language=C]{#1}}
-\newrobustcmd*\codeCpp[1]{\lstinline[language=C++]{#1}}
-\newrobustcmd*\codePy[1]{\lstinline[language=Python]{#1}}
-
-% Colour text, formatted in LaTeX style instead of TeX style.
-\newcommand*\colour[2]{{\color{#1}#2}}
-\makeatother
-
-\input{common}
+\lstMakeShortInline@
+
 % CFA code-style for all languages
 \CFAStyle
