%description: Book template

% template of document for LaTeX
% (C) Xavier Perseguers 2002 - xavier.perseguers@epfl.ch

\documentclass[a4paper,11pt]{book}

%  makeindex NEMO_book     <== to regenerate the index
%  bibtex         NEMO_book	<== to generate  the bibliography

% ================================================================
% HEADERS DEFINITION
% ================================================================

\usepackage[french]{babel}
%\usepackage{color}
\usepackage{xcolor}
%\usepackage{graphics}				% allows insertion of pictures
\usepackage{graphicx}				% allows insertion of
                                        % pictures
\usepackage[capbesideposition={top,center}]{floatrow}
\floatsetup[table]{style=plaintop}
\usepackage[margin=10pt,font={small},labelsep=colon,labelfont={bf}]{caption}
%\usepackage{colortbl}                           % gives coloured panels behind table columns

%hyperref
\usepackage[					%
  pdftitle={NEMO ocean engine},	%
  pdfauthor={Gurvan Madec},		% pdfsubject={The preprint document class
                           				% elsart},% pdfkeywords={diapycnal diffusion,numerical mixing,z-level models},%
  pdfstartview=FitH,				%
  bookmarks=true,				%
  bookmarksopen=true,			%
  breaklinks=true,				%
  colorlinks=true,				%
  linkcolor=blue,anchorcolor=blue,	%
  citecolor=blue,filecolor=blue,		%
 menucolor=blue,                   	%
  urlcolor=blue]{hyperref}
%  usage of exteranl hyperlink :  \href{mailto:my_address@wikibooks.org}{my\_address@wikibooks.org}
%                                                 \url{http://www.wikibooks.org}
%                                     or         \href{http://www.wikibooks.org}{wikibooks home}



%%%% page styles etc................
\usepackage{fancyhdr}
\pagestyle{fancy}
% with this we ensure that the chapter and section
% headings are in lowercase.
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\fancyhf{}             % delete current setting for header and footer
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\hspace{-0em}\rightmark}
\fancyhead[RE]{\bfseries\leftmark}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{2.6pt}   % make space for the rule
%\addtolength{\headheight}{1.6pt}   % make space for the rule
\fancypagestyle{plain}{
  \fancyhead{}         % get rid of headers on plain pages
  \renewcommand{\headrulewidth}{0pt}  % and the line
}


%%%%  Section number in Margin.......
% typeset the number of each section in the left margin, with the start of each instance of
% sectional heading text aligned with the left hand edge of  the body text.
\makeatletter
\def\@seccntformat#1{\protect\makebox[0pt][r]{\csname the#1\endcsname\quad}}
\makeatother

% Leave blank pages completely empty, w/o header
\makeatletter
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
  \hbox{}
  \vspace*{\fill}
  \vspace{\fill}
  \thispagestyle{empty}
  \newpage
  \if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother

%%%% define the chapter  style ................
\usepackage{minitoc}				%In French : \usepackage[french]{minitoc}
%\usepackage{mtcoff}				% invalidate the use of minitocs
\usepackage{fancybox}

\makeatletter
\def\LigneVerticale{\vrule height 5cm depth 2cm\hspace{0.1cm}\relax}
\def\LignesVerticales{%
  \let\LV\LigneVerticale\LV\LV\LV\LV\LV\LV\LV\LV\LV\LV}
\def\GrosCarreAvecUnChiffre#1{%
  \rlap{\vrule height 0.8cm width 1cm depth 0.2cm}%
 \rlap{\hbox to 1cm{\hss\mbox{\color{white} #1}\hss}}%
  \vrule height 0pt width 1cm depth 0pt}
\def\GrosCarreAvecTroisChiffre#1{%
  \rlap{\vrule height 0.8cm width 1.6cm depth 0.2cm}%
 \rlap{\hbox to 1.5cm{\hss\mbox{\color{white} #1}\hss}}%
  \vrule height 0pt width 1cm depth 0pt}

\def\@makechapterhead#1{\hbox{%
   \huge
    \LignesVerticales
    \hspace{-0.5cm}%
    \GrosCarreAvecUnChiffre{\thechapter}
    \hspace{0.2cm}\hbox{#1}%
%    \GrosCarreAvecTroisChiffre{\thechapter}
%    \hspace{1cm}\hbox{#1}%
%}\par\vskip 2cm}
}\par\vskip 1cm}
\def\@makeschapterhead#1{\hbox{%
   \huge
    \LignesVerticales
    %\hspace{0.5cm}%
    \hbox{#1}%
}\par\vskip 2cm}
\makeatother

%\def\thechapter{\Roman{chapter}}   	% chapter number to be Roman


%%%%           Mathematics...............
%\documentclass{amsart}
\usepackage{xspace}                              % helpd ensure correct spacing after macros
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{amsmath}
\allowdisplaybreaks[1]				% allow page breaks in the middle of equations
\usepackage{./TexFiles/math_abbrev}    % use maths shortcuts


\usepackage{times}				 	 % use times font for text
%\usepackage{mathtime}                          % font for illustrator to work (belleek fonts )
%\usepackage[latin1]{inputenc}                % allows some unicode removed (agn)


%%% essai commande
\newcommand{\nl} [1] {\texttt{\small {\textcolor{blue}{#1}} } }
\newcommand{\nlv} [1] {\texttt{\footnotesize#1}\xspace}
\newcommand{\smnlv} [1] {\texttt{\scriptsize#1}\xspace}

%%%% namelist & code display................................
\usepackage{alltt}  		%%  alltt for namelist
\usepackage{verbatim}  	%%  alltt for namelist
% namelists
\newcommand{\namdisplay} [1] {
\begin{alltt}
{\tiny \verbatiminput{./TexFiles/Namelist/#1}}
\end{alltt}
  \vspace{-10pt}
}
% code display
%\newcommand{\codedisplay} [1] { \begin{alltt} {\tiny  {\begin{verbatim} {#1}} \end{verbatim} }  \end{alltt}   }



%%%% commands for working with text................................
% command to "comment out" portions of text ({} argument) or not ({#1} argument)
\newcommand{\amtcomment}[1]{}   	% command to "commented out" portions of text or not (#1 in argument)
\newcommand{\sgacomment}[1]{}   	% command to "commented out" portions of
\newcommand{\gmcomment}[1]{}   	% command to "commented out" portions of
%                                    				% text that span line breaks
%Red (NR) or Yellow(WARN)
%\newcommand{\NR} {\colorbox{red}{#1}}
%\newcommand{\WARN} {{ \colorbox{yellow}{#1}} }



%%% index commands......................
\usepackage{makeidx}
%\usepackage{showidx}				% show the index entry

\newcommand{\mdl} [1] {\textit{#1.F90}\index{Modules!#1}}			%module (mdl)
\newcommand{\rou} [1] {\textit{#1}\index{Routines!#1}}				%module (routine)
\newcommand{\hf} [1] {\textit{#1.h90}\index{h90 file!#1}}				%module (h90 files)
\newcommand{\np} [1] {\textit{#1}\index{Namelist parameters!#1}}		%namelist parameter (nampar)
\newcommand{\jp} [1] {\textit{#1}\index{Model parameters!#1}}			%model parameter (jp)
\newcommand{\pp} [1] {\textit{#1}\index{Model parameters!#1}}		 	%namelist parameter (pp)
\newcommand{\ifile} [1] {\textit{#1.nc}\index{Input NetCDF files!#1.nc}}	%input NetCDF files (.nc)
\newcommand{\key} [1] {\textbf{key\_#1}\index{CPP keys!key\_#1}}	%key_cpp (key)
\newcommand{\NEMO} {\textit{NEMO}\xspace}						%NEMO (nemo)

%%%%   Bibliography   .............
\usepackage[nottoc, notlof, notlot]{tocbibind}
\usepackage[square, comma]{natbib}
\bibpunct{[}{]}{,}{a}{}{;}                           %suppress "," after "et al."
\providecommand{\bibfont}{\small}


% ================================================================
% FRONT PAGE
% ================================================================

\usepackage{pstricks}
\title{
\psset{unit=1.1in,linewidth=4pt} 	%parameters of the units for pstricks
%\rput(-1.4,2){ \includegraphics[width=0.2\textwidth]{./TexFiles/Figures/logo_CNRS.pdf}           }
%\quad
%\rput(-.15,2){ \includegraphics[width=0.2\textwidth]{./TexFiles/Figures/logo_MERCATOR.pdf} }
%\quad
%\rput(.85,2){ \includegraphics[width=0.1\textwidth]{./TexFiles/Figures/logo_UKMO.pdf}            }
%\quad
%\rput(1.85,2){ \includegraphics[width=0.2\textwidth]{./TexFiles/Figures/logo_NERC.pdf}             } \\
%\begin{figure}[t]
%   \includegraphics[width=0.9\textwidth]{./TexFiles/Figures/logo_ALL.pdf}
%\end{figure}
\rput(0,2){ \includegraphics[width=1.1\textwidth]{./TexFiles/Figures/logo_ALL.pdf}             } \\
\vspace{0.1cm}
\includegraphics[width=0.9\textwidth]{./TexFiles/Figures/NEMO_logo_Black.pdf} \\
\vspace{1.4cm}
\rule{345pt}{1.5pt} \\
\vspace{0.45cm}
{\Huge NEMO ocean engine}
\rule{345pt}{1.5pt} \\
 }
%{ -- Draft --}   }
%\date{\today}
\date{
January 2012  \\
{\small  -- version 3.4 --} \\
~  \\
\textit{\small Note du P\^ole de mod\'{e}lisation de l'Institut Pierre-Simon Laplace No 27 }\\
\vspace{0.45cm}
{ ISSN No 1288-1619.}
}


\author{
\Large Gurvan Madec, and the NEMO team  \\
 \texttt{\small gurvan.madec@locean-ipsl.umpc.fr} \\
 \texttt{\small nemo\_st@hermes.locean-ipsl.umpc.fr} \\
%{\small Laboratoire d'Oc\'{e}anographie  et du Climat: Exp\'{e}rimentation et Approches Num\'{e}riques }
}

\dominitoc
\makeindex  		%type this first :     makeindex -s NEMO.ist NEMO_book.idx

% ================================================================
%      Include ONLY order
% ================================================================

%\includeonly{./TexFiles/Chapters/Chap_MISC}
%\includeonly{./TexFiles/Chapters/Chap_ZDF}
%\includeonly{./TexFiles/Chapters/Chap_STP,./TexFiles/Chapters/Chap_SBC,./TexFiles/Chapters/Chap_TRA}
%\includeonly{./TexFiles/Chapters/Chap_LBC,./TexFiles/Chapters/Chap_MISC}
%\includeonly{./TexFiles/Chapters/Chap_Model_Basics}
%\includeonly{./TexFiles/Chapters/Annex_A,./TexFiles/Chapters/Annex_B,./TexFiles/Chapters/Annex_C,./TexFiles/Chapters/Annex_D}

% ================================================================
% ================================================================
\begin{document}

\maketitle						% generate the title

\frontmatter

\tableofcontents					% generate a table of contents
%\listoffigures					% generate a list  of figures
%\listoftables					        % generate a list of tables

\mainmatter

% ================================================================
% Abstract - Foreword
% ================================================================

\include{./TexFiles/Chapters/Abstracts_Foreword}

% ================================================================
% INTRODUCTION
% ================================================================

\include{./TexFiles/Chapters/Introduction}

% ================================================================
% CHAPTERS
% ================================================================

\include{./TexFiles/Chapters/Chap_Model_Basics}

\include{./TexFiles/Chapters/Chap_STP}			% Time discretisation (time stepping strategy)

\include{./TexFiles/Chapters/Chap_DOM}			% Space discretisation

\include{./TexFiles/Chapters/Chap_TRA}			% Tracer advection/diffusion equation

\include{./TexFiles/Chapters/Chap_DYN}			% Dynamics : momentum equation

\include{./TexFiles/Chapters/Chap_SBC}			% Surface Boundary Conditions

\include{./TexFiles/Chapters/Chap_LBC}			% Lateral Boundary Conditions

\include{./TexFiles/Chapters/Chap_LDF}			% Lateral diffusion

\include{./TexFiles/Chapters/Chap_ZDF}			% Vertical diffusion

\include{./TexFiles/Chapters/Chap_DIA}			% Miscellaneous topics

\include{./TexFiles/Chapters/Chap_OBS}                  % Observation operator

\include{./TexFiles/Chapters/Chap_ASM}                  % Assimilation increments

\include{./TexFiles/Chapters/Chap_MISC}			% Miscellaneous topics

\include{./TexFiles/Chapters/Chap_CFG}			% Predefined configurations

% ================================================================
% APPENDIX
% ================================================================

\appendix

%\include{./TexFiles/Chapters/Chap_Conservation}
\include{./TexFiles/Chapters/Annex_A}			% generalised vertical coordinate
\include{./TexFiles/Chapters/Annex_B}			% diffusive operator
\include{./TexFiles/Chapters/Annex_C}			% Discrete invariants of the eqs.
\include{./TexFiles/Chapters/Annex_D}			% Coding rules
\include{./TexFiles/Chapters/Annex_ISO}	                  % Isoneutral diffusion using triads
%\include{./TexFiles/Chapters/Annex_E}	                  % Notes on some on going staff (no included in the DOC)
%\include{./TexFiles/Chapters/Annex_Fox-Kemper}   % Notes on Fox-Kemper (no included in the DOC)
%\include{./TexFiles/Chapters/Annex_EVP}        	% Notes on EVP (no included in the DOC)

% ================================================================
% INDEX
% ================================================================

\addcontentsline{toc}{chapter}{Index}
\printindex

% ================================================================
% BIBLIOGRAPHY
% ================================================================

%%\bibliographystyle{plainat}
\bibliographystyle{./TexFiles/ametsoc}		% AMS biblio style (JPO)
\bibliography{./TexFiles/Biblio/Biblio}

% ================================================================
\end{document}
