%Numbered citations are less intrusive, and this also formats the references
% section.
\usepackage[numbers]{natbib}

%Various color options for fonts and graphics
\usepackage{xcolor}

%Figures and good looking (embedded) graphs are nice
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{patterns}
\usetikzlibrary{calc}
\usetikzlibrary{fit}
\pgfplotsset{compat=1.8}

%Format subfigures relative to each other and text
\usepackage[labelsep=quad,font=footnotesize]{subcaption}
\usepackage{wrapfig}

%Clickable, formatted links
\usepackage{hyperref}
\usepackage{url}
\def\UrlFont{\small\tt}

%We want the math fonts to look good. And the right size.
%\usepackage[cmintegrals]{newtxmath}
%note this also loads amsmath and amsfonts
\let\openbox\relax
\let\proof\relax
\let\endproof\relax
\usepackage{amssymb,amsthm,mathtools}
\usepackage{relsize}

%Format the code in the snippets
\usepackage{listings} 
%Snippet looks better than Listing since we only use it for code
\renewcommand{\lstlistingname}{Snippet}
\lstset{escapeinside={(*@}{@*)}}
%colors for keywords, comments, etc.
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
%Code format
\lstset{frame=none,
  language=Java,
  aboveskip=1.5mm,
  belowskip=1.5mm,
  showstringspaces=false,
  columns=flexible,
  basicstyle=\tt\small,
  numbers=left,
  numberstyle=\footnotesize\color{gray},
  keywordstyle=\tt\color{blue}\bfseries,
  commentstyle=\color{dkgreen},
  stringstyle=\color{mauve},
  breaklines=true,
  breakatwhitespace=true,
  tabsize=2,
  emptylines=1,
  showlines=false
  morekeywords={event,let,in,when,string}
}

%Some of the the algorithms are in pseudocode
%\usepackage{algpseudocode}
\usepackage{algorithm}
\usepackage{algorithmic}

%Make my TODO comments stand out so I can see what I still need to address
\usepackage[draft,inline,nomargin,noindex]{fixme}
\fxsetup{theme=color,mode=multiuser}
\FXRegisterAuthor{wc}{wjc}{\colorbox{red}{\color{black}WJC:}}
% refedine the layout macro:
\makeatletter
\renewcommand*\FXLayoutInline[3]{%
  \@fxdocolon {#3}{%
    \@fxuseface {inline}%
    \begingroup
      \sethlcolor{fx#1bg}%
      \color {fx#1}\ignorespaces \hl{#3\@fxcolon #2}%
    \endgroup}}
\makeatother

%I don't need to change the margins this time
%\usepackage[letterpaper,margin=1in]{geometry}

%Math stuff
\usepackage{relsize}
\usepackage{amssymb,amsfonts,amsmath}%amsthm
\usepackage{mathtools}

%FONT AND TYPESETTING
%Automatically get rid of widowed section headers (and open up some space saving options if need be)
%Uncomment this if a colleague has an older version of titlesec
% \newcommand{\subparagraph}{}
\usepackage{titlesec}
%Change the standard and math fonts
%\usepackage{pxfonts}
%\usepackage{mathptmx}
\usepackage[largesc, lining]{newtxtext}
\usepackage[varg, slantedGreek, bigdelims]{newtxmath}
%Change default monospace font to prettier font
\renewcommand{\ttdefault}{pxtt}
%Use t1 for better character output support beyond traditional ASCII
\usepackage[T1]{fontenc}
%I don't think I type non-ASCII, but if so this allows the compiler to read them
\usepackage[ansinew]{inputenc}
%Stretch and compress text by up to 1\% for a more natural (and slightly space saving) look.
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}
%Microtype tweaks. Tracking is fine, but the default values make NARJOIN look
% too spaced out.
\SetTracking{encoding={*}, shape=sc}{10}
\usepackage{setspace}

%Highly discourages LaTeX from choosing to split pages with widows or orphans.
%Conferences hate these (for good reason), and they are a pain to find and fix manually.
\widowpenalty=10000
\clubpenalty=10000
\brokenpenalty=10000
%Make LaTeX more hesitant about hyphenating words for line breaks
\hyphenpenalty=1000
%Properly there should not be a double space after a sentence
\frenchspacing

%By default I find the space between rows larger than pleasing, and definitely a bit wasteful
\renewcommand{\arraystretch}{1.4}