% -----------------------------------------------------------------------
% Guide.tex: Base latex file for the User's Guide.
% -----------------------------------------------------------------------
% Copyright (C) 2006, Matthew Whiting, ATNF
%
% This program 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 2 of the License, or (at your
% option) any later version.
%
% Duchamp 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 Duchamp; if not, write to the Free Software Foundation,
% Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
%
% Correspondence concerning Duchamp may be directed to:
%    Internet email: Matthew.Whiting [at] atnf.csiro.au
%    Postal address: Dr. Matthew Whiting
%                    Australia Telescope National Facility, CSIRO
%                    PO Box 76
%                    Epping NSW 1710
%                    AUSTRALIA
% -----------------------------------------------------------------------
\documentclass[11pt,a4paper]{article}
%\documentclass[12pt,a4paper]{report}

%%%%%% LINE SPACING %%%%%%%%%%%%
\usepackage{setspace}
\singlespacing
%\onehalfspacing
%\doublespacing

%Define a test for doing PDF format -- use different code below
\newif\ifPDF
\ifx\pdfoutput\undefined\PDFfalse 
\else\ifnum\pdfoutput > 0\PDFtrue 
     \else\PDFfalse 
     \fi 
\fi

%\textwidth=165 mm
%\textheight=245 mm
%\topmargin=0 mm
%\oddsidemargin=0 mm
%\parindent=6 mm

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{xspace}
\usepackage[sort]{natbib}
\bibpunct[,]{(}{)}{;}{a}{}{,}

%\newcommand{\secA}{\chapter}
%\newcommand{\secB}{\section}
%\newcommand{\secC}{\subsection}

\newcommand{\secA}{\section}
\newcommand{\secB}{\subsection}
\newcommand{\secC}{\subsubsection}

\newcommand{\version}{1.1.9}

\newcommand{\eg}{e.g.\ }
\newcommand{\ie}{i.e.\ }
\newcommand{\hi}{H\textsc{i}\xspace}
\newcommand{\hipass}{\textsc{hipass}\xspace}
\newcommand{\duchamp}{\emph{Duchamp}\xspace}
\newcommand{\atrous}{\textit{{\`a} trous}\xspace}
\newcommand{\Atrous}{\textit{{\`A} trous}\xspace}
\newcommand{\diff}{{\rm d}}
\newcommand{\entrylabel}[1]{\mbox{\texttt{#1:}}\hfil}
\newenvironment{entry}
        {\begin{list}{}%
                {\renewcommand{\makelabel}{\entrylabel}%
                        \setlength{\leftmargin}{33mm}%
                        \setlength{\labelwidth}{33mm}%
                        \setlength{\labelsep}{0pt}%
                        \setlength{\itemsep}{3pt}%
                        \setlength{\parsep}{2pt}%
                }%
        }%
{\end{list}}

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

\newlength{\MyLen}
\newcommand{\Lentrylabel}[1]{%
  \settowidth{\MyLen}{\texttt{#1:}}%
%  \setlength{\labelwidth}{30mm}%
  \ifthenelse{\lengthtest{\MyLen > \labelwidth}}%
    {\parbox[b]{\labelwidth}% term > labelwidth
      {\makebox[0pt][l]{\texttt{#1:}}\\}}%
    {\texttt{#1:}}% term < labelwidth
    \hfil\relax}

\newenvironment{Lentry}%
	       {\renewcommand{\entrylabel}{\Lentrylabel}\begin{entry}
		   \setlength{\itemsep}{3pt}%
%		   \setlength{\leftmargin}{25mm}%
%                  \setlength{\itemindent}{0mm}%
%                  \setlength{\listparindent}{0mm}%
                   \setlength{\labelsep}{0mm}%
	       }%
	       {\end{entry}%
	       }

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

\newcommand{\Mentrylabel}[1]%
	   {\raisebox{0pt}[1ex][0pt]{\makebox[\labelwidth][l]%
	       {\parbox[t]{\labelwidth}{\hspace{0pt}\texttt{#1}}}}}
\newenvironment{Mentry}
	       {\renewcommand{\entrylabel}{\Mentrylabel}\begin{entry}%
		   \setlength{\labelwidth}{33mm}%
                   \setlength{\leftmargin}{35mm}%
	       }%
	       {\end{entry}%
	       }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%% FANCY HEADINGS %%%%%%%%%%
%\usepackage{fancyheadings}
%\pagestyle{fancyplain}
%\addtolength{\headheight}{1.6pt}
%\addtolength{\headwidth}{\marginparsep}
%\addtolength{\headwidth}{\marginparwidth}
%\renewcommand{\secAmark}[1]
%                {\markboth{#1}{}}
%\renewcommand{\secBmark}[1]
%                {\markright{\thesection\ #1}}
%\lhead[\fancyplain{}{\bfseries\thepage}]
%      {\fancyplain{}{\bfseries\rightmark}}
%\rhead[\fancyplain{}{\bfseries\leftmark}]
%      {\fancyplain{}{\bfseries\thepage}}
%\cfoot{}

% If we are creating a PDF, use different options for graphicx, hyperref.
\ifPDF
  \usepackage[pdftex]{graphicx,color}
  \usepackage[pdftex,bookmarks]{hyperref}
  \hypersetup{colorlinks=true,% 	    
              citecolor=red,%
              filecolor=red,%
              linkcolor=red,%
              urlcolor=red,%
              }
\else
  \usepackage[dvips]{graphicx} 
  \usepackage[dvips]{hyperref} 
\fi

\usepackage{lscape}
\usepackage[dvips]{rotating}
%\rotdriver{dvips}

\pagestyle{headings}
\begin{document}

\ifPDF
\pdfbookmark[2]{Title Page}{title}
\fi
\newlength{\centreoff}
\setlength{\centreoff}{-0.5\oddsidemargin}
\addtolength{\centreoff}{0.5\evensidemargin}
\thispagestyle{empty}
\vspace*{\stretch{1}}
\noindent\hspace*{\centreoff}%
\makebox[0pt][l]{\begin{minipage}{\textwidth}
\flushright
{\Huge\bfseries Source Detection with \duchamp\\[2ex]}
{\huge\bfseries A User's Guide

}
\noindent\rule[-1ex]{\textwidth}{3pt}
\end{minipage}}

\vspace{\stretch{1}}
\noindent\hspace*{\centreoff}%
\makebox[0pt][l]{\begin{minipage}{\textwidth}
\flushright
{\bfseries 
Matthew Whiting\\
Australia Telescope National Facility\\
CSIRO\\[3ex]} 
Duchamp version~\version\\
March 19, 2010
\end{minipage}}

\begin{figure}[!h]
%\begin{center}
\includegraphics[width=\textwidth]{cover_image}
%\end{center}
\end{figure}

%\newpage
\ifPDF
\pdfbookmark[2]{Contents}{contents}
\fi
\tableofcontents

\newpage
\input{intro} %Introduction and getting going quickly
\newpage
\input{userInputs} %User Inputs
\newpage
\input{executionFlow} %What \duchamp is doing
\newpage
\input{outputs} %Outputs
\newpage
\newpage
\input{hints} %Notes and hints on the use of \duchamp
\newpage
\input{future} %Future developments

%\bibliographystyle{plainnat}
%\bibliographystyle{mn2e}
%\bibliography{guide}

\newpage
\ifPDF
\pdfbookmark[1]{References}{references}
\fi
\ifPDF
\input{Guide-URL-bib}
\else
\input{Guide-noURL-bib}
\fi

\appendix
\newpage
\input{app-install} %Obtaining and installing \duchamp
\newpage
\input{app-param} %Available parameters
\newpage
\input{app-paramEx} %Example parameter files
\newpage
\input{app-resultsEx} %Example results files
\newpage
\input{app-VOTable} %Example VOTable output
\newpage
\input{app-Karma} %Example Karma annotation file output
\newpage
\input{app-stats} %Robust statistics for a Normal distribution
\newpage
\input{app-waveletNoise} %How Gaussian noise changes with wavelet scale


\end{document}
