% thesis-preamble.tex --- package imports and page setup -*-latex-*-

% Copyright (C) 2020 Amin Bandali <bandali@uwaterloo.ca>

% This file is part of Amin Bandali's MMath thesis.

% This thesis is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.

% This thesis is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.

% You should have received a copy of the GNU General Public License
% along with this thesis.  If not, see <https://www.gnu.org/licenses/>.


%% for hyperlinked PDF, suitable for viewing on a computer
\documentclass[letterpaper,12pt,titlepage,oneside,final]{book}

%% for double-sided printing
%% (remember to change PrintVersion below to "true")
% \documentclass[letterpaper,12pt,titlepage,openright,twoside,final]{book}

%% ===================================================================
%% Packages and definitions
%% ===================================================================

%% import a few key packages first (used in thesis-defs below)
\usepackage{xcolor}
\usepackage{amsmath,amssymb,amstext}
\usepackage{bsymb}

%% import various definitions used throughout the thesis
\input{thesis-defs}

%% lstlisting language syntax definitions
\input{syntax/b}
\input{syntax/dash}
\input{syntax/tla}
\input{syntax/event-b}
\input{syntax/alloy}
\input{syntax/pluscal}
\input{syntax/asmetal}

\usepackage{ifthen}
\newboolean{PrintVersion}
\setboolean{PrintVersion}{false}

\usepackage{enumitem}

%% use with \nocite{*} to find unused references
% \usepackage{refcheck}

\usepackage{epigraph}

\usepackage{caption}
\captionsetup[table]{skip=5pt}

%% font settings
\usepackage[no-math]{fontspec}
\usepackage[lining,semibold]{ebgaramond}
\usepackage[cmintegrals,cmbraces]{newtxmath}
\usepackage{ebgaramond-maths}
\setmonofont[Scale=0.87]{inconsolata}
\usepackage{microtype}

\usepackage{diagbox}

\usepackage{setspace}

\usepackage{tikz}
\usetikzlibrary{arrows.meta, automata, decorations,
  decorations.pathreplacing, positioning}

\usepackage{relsize}

\usepackage{wrapfig}

\usepackage{metalogo}

\usepackage{hyperref}
\hypersetup{
  pdfstartview={FitH},      % fit the width of the page to the window
  pdftitle={\thesistitle},
  pdfauthor={\name},
  pdfsubject={Formal Methods, Computer Science},
  pdfkeywords={formal methods, model checking, declarative modelling,
    declarative modelling languages},
  pdfcreator={GNU Emacs 28.0.50},
  pdflang={English},
  pdfnewwindow=true,
  colorlinks=true,          % false: boxed links; true: coloured links
  linkcolor=blue,           % internal links
  citecolor=purple,         % links to bibliography
  filecolor=magenta,        % file links
  urlcolor=eclipseBlue      % external links
}
\ifthenelse{\boolean{PrintVersion}}{
  \hypersetup{     % override some hyperref options
    %  colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=black}
}{}

%% use rmfamily instead of ttfamily for urls
\urlstyle{rm}


%% ===================================================================
%% Page layout settings
%% ===================================================================

%% 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

%% if margin notes are used, be sure to 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.)

%% width of space between body text and margin notes
\setlength{\marginparsep}{0pt}

%% add 1/8 in. to binding side of all even-numbered pages when the
%% "twoside" printing option is selected
\setlength{\evensidemargin}{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{\oddsidemargin}{0.125in}

%% assuming US letter paper (8.5 in. x 11 in.) and side margins as
%% above
\setlength{\textwidth}{6.375in}

\raggedbottom

%% specify the amount of space between paragraphs; other reasonable
%% specifications are \bigskipamount and \smallskipamount
\setlength{\parskip}{\medskipamount}

%% adjust line spacing
\setstretch{1.1}

%% By default, each chapter will start on a recto (right-hand side)
%% page.  We also force each section of the front pages to start on a
%% recto page by inserting \cleardoublepage commands.  In many cases,
%% this will require that the verso page be blank and, while it should
%% be counted, a page number should not be printed.  The following
%% statements ensure a page number is not printed on an otherwise blank
%% verso page.
\let\origdoublepage\cleardoublepage
\newcommand{\clearemptydoublepage}{%
  \clearpage{\pagestyle{empty}\origdoublepage}}
\let\cleardoublepage\clearemptydoublepage


%% Local Variables:
%% tex-main-file: "./bandali-mmath-thesis.tex"
%% End:
