% requires tex packages: texlive-base texlive-latex-base tex-common texlive-humanities texlive-latex-extra texlive-fonts-recommended

\documentclass[letterpaper,12pt,titlepage,oneside,final]{book}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Latex packages used in the document.
\usepackage{fullpage,times,comment}
\usepackage{textcomp}
\usepackage{epic,eepic}
\usepackage{dirtytalk}
\usepackage{xspace}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage[acronym]{glossaries}
\usepackage{listings}						% format program code
\usepackage[flushmargin]{footmisc}				% support label/reference in footnote
\usepackage{mathptmx}						% better math font with "times"
\usepackage[usenames]{color}
\usepackage[pagewise]{lineno}
\renewcommand{\linenumberfont}{\scriptsize\sffamily}
\usepackage{fancyhdr}
\usepackage{float}
\input{style}							% bespoke macros used in the document
\usepackage[dvips,plainpages=false,pdfpagelabels,pdfpagemode=UseNone,colorlinks=true,pagebackref=true,linkcolor=blue,citecolor=blue,urlcolor=blue,pagebackref=true,breaklinks=true]{hyperref}
\urlstyle{rm}
% \usepackage{breakurl} % used to avoid line breaks inside urls -> uncomment later if needed

\usepackage{tikz}
\def\checkmark{\tikz\fill[scale=0.4](0,.35) -- (.25,0) -- (1,.7) -- (.25,.15) -- cycle;}

% Setting up the page margins...
\setlength{\textheight}{9in}
\setlength{\topmargin}{-0.45in}
\setlength{\headsep}{0.25in}
% uWaterloo thesis requirements specify a minimum of 1 inch (72pt) margin at the
% top, bottom, and outside page edges and a 1.125 in. (81pt) gutter margin (on binding side).
% While this is not an issue for electronic viewing, a PDF may be printed, and so we have the same page layout for both printed and electronic versions, we leave the gutter margin in.
% Set margins to minimum permitted by uWaterloo thesis regulations:
\setlength{\marginparwidth}{0pt} % width of margin notes
% N.B. If margin notes are used, you must adjust \textwidth, \marginparwidth
% and \marginparsep so that the space left between the margin notes and page
% edge is less than 15 mm (0.6 in.)
\setlength{\marginparsep}{0pt} % width of space between body text and margin notes
\setlength{\evensidemargin}{0.125in} % Adds 1/8 in. to binding side of all
% even-numbered pages when the "twoside" printing option is selected
\setlength{\oddsidemargin}{0.125in} % Adds 1/8 in. to the left of all pages when "oneside" printing is selected, and to the left of all odd-numbered pages when "twoside" printing is selected
\setlength{\textwidth}{6.375in} % assuming US letter paper (8.5 in. x 11 in.) and side margins as above
\raggedbottom

% The following statement specifies the amount of space between paragraphs. Other reasonable specifications are \bigskipamount and \smallskipamount.
\setlength{\parskip}{\medskipamount}

\newsavebox{\myboxA}					% used with subfigure
\newsavebox{\myboxB}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Names used in the document.

\newcommand{\Version}{1.0.0}
\newcommand{\CS}{C\raisebox{-0.9ex}{\large$^\sharp$}\xspace}

\newcommand{\Textbf}[2][red]{{\color{#1}{\textbf{#2}}}}
\newcommand{\Emph}[2][red]{{\color{#1}\textbf{\emph{#2}}}}
\newcommand{\R}[1]{\Textbf{#1}}
\newcommand{\B}[1]{{\Textbf[blue]{#1}}}
\newcommand{\G}[1]{{\Textbf[OliveGreen]{#1}}}
\newcommand{\uC}{$\mu$\CC}
\newcommand{\cit}{\textsuperscript{[Citation Needed]}\xspace}
\newcommand{\TODO}{{\Textbf{TODO}}}

\input{glossary}

\newsavebox{\LstBox}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\setcounter{secnumdepth}{2}                           % number subsubsections
\setcounter{tocdepth}{2}                              % subsubsections in table of contents
% \linenumbers                                       	% comment out to turn off line numbering
\makeindex
\pagestyle{fancy}
\fancyhf{}
\cfoot{\thepage}
\rfoot{v\input{version}}



%======================================================================
%   L O G I C A L    D O C U M E N T -- the content of your thesis
%======================================================================
\begin{document}
\newtheorem{theorem}{Theorem}

% For a large document, it is a good idea to divide your thesis
% into several files, each one containing one chapter.
% To illustrate this idea, the "front pages" (i.e., title page,
% declaration, borrowers' page, abstract, acknowledgements,
% dedication, table of contents, list of tables, list of figures,
% nomenclature) are contained within the file "thesis-frontpgs.tex" which is
% included into the document by the following statement.
%----------------------------------------------------------------------
% FRONT MATERIAL
%----------------------------------------------------------------------
\input{frontpgs}

%----------------------------------------------------------------------
% MAIN BODY
%----------------------------------------------------------------------

\input{intro}

\input{CFA_intro}

\input{CFA_concurrency}

\input{mutex_stmt}

\input{channels}

\input{actors}

\clearpage

% B I B L I O G R A P H Y
% -----------------------------
\addcontentsline{toc}{chapter}{Bibliography}
\bibliographystyle{plain}
\bibliography{pl,local}
\cleardoublepage
\phantomsection		% allows hyperref to link to the correct page

% G L O S S A R Y
% -----------------------------
\addcontentsline{toc}{chapter}{Glossary}
\printglossary
\cleardoublepage
\phantomsection		% allows hyperref to link to the correct page


\end{document}
