% -*- latex -*-
\documentclass{InsightSoftwareGuide}
\usepackage[
  paper=letterpaper,
  paperwidth=8in,
  paperheight=10in,
  lmargin=0.75in,
  rmargin=0.5in,
  tmargin=0.75in,
  bmargin=0.75in]{geometry}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Uncomment for draft mode.
\usepackage{draftwatermark}
\SetWatermarkText{DRAFT}
\SetWatermarkColor[rgb]{.9,1,.9}
\newcommand{\fix}[1]{{\color{red}\textsc{[#1]}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Uncomment to hide fix markup for final mode.
%% \newcommand{\fix}[1]{}


\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{isomath}
\usepackage{varioref}
\usepackage{fancyvrb}
\usepackage{ifthen}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{cite}
\usepackage{relsize}
\usepackage{subfig}
\usepackage{url}
\usepackage{xspace}
\usepackage{xparse}

% to minimize item separation in lists.
\usepackage{enumitem}

% This wonderful package allows hyphenation in tt fonts and hyphenation of
% words with underscores in them.
\usepackage[htt]{hyphenat}

% This package defines a tt font that supports boldface (albeit not very
% distinctly). The default package has no boldface for tt fonts.
\usepackage{lmodern}

\usepackage{makeidx}
\makeindex

%% \usepackage[pdfborder={0 0 0}]{hyperref}
\usepackage[colorlinks=true,urlcolor=blue,citecolor=black,linkcolor=black,final=true]{hyperref}
\usepackage{verbatim}

\usepackage{color}
\definecolor{yellow}{rgb}{1,1,0}
\definecolor{black}{rgb}{0,0,0}
\definecolor{ltcyan}{rgb}{.75,1,1}
\definecolor{red}{rgb}{1,0,0}
\definecolor{gray}{rgb}{.6,.6,.6}
\definecolor{darkred}{rgb}{0.5,0,0}
\definecolor{darkgreen}{rgb}{0,0.5,0}

\input{Macros}
\input{LanguageDefinitions}

% Make fancy headers and everything...
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyhead[LE,RO]{\small \nouppercase{\rightmark}}
\fancyfoot{}
\fancyfoot[LE,RO]{\small \thepage}
\fancyfoot[RE,LO]{\small \nouppercase{\leftmark}}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0.5pt}
%\setlength{\headheight}{14pt}

\fancypagestyle{plain}{%
  \fancyhead{} % get rid of headers on plain pages
  \fancyfoot{} % get rid of the footer on plain pages
  \renewcommand{\headrulewidth}{0pt} % and the top line
  \renewcommand{\footrulewidth}{0pt} % and the bottom line
}

% Avoid putting figures on their own page.
\renewcommand{\textfraction}{0.05}
\renewcommand{\topfraction}{0.95}
\renewcommand{\bottomfraction}{0.95}

% Make sure this is big enough so that only big figures end up on their own
% page but small enough so that if a figure does have to be on its own
% page, it won't push everything to the bottom because it's not big enough
% to have its own page.
\renewcommand{\floatpagefraction}{.75}

\setcounter{tocdepth}{4}
\input{TitlePage}

\begin{document}

\sloppy

\frontmatter
\pagestyle{empty}
\titleGM

\clearpage
\input{Contributors}

\pagestyle{fancy}
{\small
\tableofcontents
\listoffigures
%\listoftables
\lstlistoflistings
}

\mainmatter

\ifthenelse{\equal{\buildtype}{Full} \OR \equal{\buildtype}{GettingStarted}}{

  \part{Getting Started}
  \label{part:GettingStarted}

  \input{Introduction}

  \input{BuildAndInstall}

  \input{IO}

  \input{RunningFilters}

  \input{Rendering}

}{}

\ifthenelse{\equal{\buildtype}{Full} \OR \equal{\buildtype}{Using}}{

  \part{Using VTK-m}
  \label{part:Using}

  \input{BasicProvisions}

  \input{ArrayHandle}

  \input{DeviceAdapter}

  \input{Timer}

  \input{FancyArrayStorage}

  \input{DynamicArrayHandle}

  \input{DataSet}

  \fix{Need to re-add this if Policies survive the transition to dynamic objects.}
  %% \input{Policies}

}{}

\ifthenelse{\equal{\buildtype}{Full} \OR \equal{\buildtype}{Developing}}{

  \part{Developing with VTK-m}
  \label{part:Developing}

  \input{Worklets}

  \input{Math}

  \input{WorkingWithCells}

  \input{Locators}

  \input{GeneratingCellSets}

  \input{CreatingFilters}

  \input{TryExecute}

}{}

\ifthenelse{\equal{\buildtype}{Full} \OR \equal{\buildtype}{Advanced}}{

  \part{Advanced Development}
  \label{part:Advanced}

  \fix{Need to document virtual objects (when they settle down).}
  %% \input{VirtualObjects}

  \input{ImplementingDeviceAdapters}

  \fix{At some point add a chapter on OpenGL interoperability (I guess).}
  %% \input{OpenGLInteroperability}

  \input{FunctionInterface}

  \input{WorkletArguments}

  \input{NewWorkletTypes}


}{}

\appendix
\part{Appendix}
\label{part:Appendix}
%% \input{CodingConventions}


\backmatter
%\chapter{Index}
{\small
\printindex
}
\end{document}
