%% ==============================================================================
%% NEMO_manual.sty: all customizations (packages, )
%% ==============================================================================


%% LaTeX packages
%% ==============================================================================

\usepackage{natbib}		%% bib
\usepackage{caption}		%% caption
\usepackage{xcolor}		%% color
\usepackage{silence}		%% compilation
\usepackage{times}		%% font
\usepackage{hyperref}	%% hyper
\usepackage{idxlayout}	%% index
\usepackage{enumitem}	%% list
\usepackage{minted}		%% listing
\usepackage{amsmath}		%% maths
\usepackage{fancyhdr}	%% page
\usepackage{minitoc}		%% toc
\usepackage{subfiles}	%% subdocs


%% Extensions in bundle package

\usepackage{amssymb, graphicx, longtable, makeidx, xspace}


%% Configuration

\captionsetup{margin=10pt, font={small}, labelsep=colon, labelfont={bf}}
\graphicspath{{../figures/}}
\hypersetup{
	pdftitle={NEMO ocean engine}, pdfauthor={Gurvan Madec, and the NEMO team},
	colorlinks
}
\idxlayout{font=footnotesize, columns=3}
\renewcommand{\bibfont}{\footnotesize}
\renewcommand{\bibsep}{3pt}


%% Styles
%% ==============================================================================

\pagestyle{fancy}
\bibliographystyle{../tex_sub/ametsoc}


%% Additionnal fonts

\DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it}


%% Page layout

\fancyhf{}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\bfseries\hspace{-0em}\rightmark}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\fancyhead[RE]{\bfseries\leftmark}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt  }
\addtolength{\headheight}{2.6pt}


%% Catcodes

\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\@makechapterhead#1{
	\hbox{
		\huge\LignesVerticales\hspace{-0.5cm}
		\GrosCarreAvecUnChiffre{\thechapter}\hspace{0.2cm}
		\hbox{#1}
	}
	\par\vskip
1cm
}
\def\@makeschapterhead#1{
	\hbox{
		\huge\LignesVerticales
		\hbox{#1}
	}
	\par\vskip
2cm
}
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
  \hbox{}
  \vspace*{\fill}
  \vspace{\fill}
  \thispagestyle{empty}
  \newpage
  \if@twocolumn\hbox{}\newpage\fi\fi\fi}
\def\@seccntformat#1{\protect\makebox[0pt][r]{\csname the#1\endcsname\quad}}
\makeatother


%% Macros (to check)

\def\deg{$^{\circ}$}
\def\degC{$^{\circ}C$}
\def\degK{$^{\circ}K$}
\def\degN{$^{\circ}N$}
\def\degS{$^{\circ}S$}

\def\half{\textstyle\frac{1}{2}}
\def\hhalf{\scriptstyle\frac{1}{2}}

\def\quarter{\textstyle\frac{1}{4}}
\def\qquarter{\scriptstyle\frac{1}{4}}
\def\squarter{\sfrac{1}{4}}
\def\stwelfth{\sfrac{1}{12}}
\def\sthirtysixth{\sfrac{1}{36}}

\def\bgamma\boldsymbol{\gamma}
\def\rdt{\Delta t}


%% New commands

\newcommand{\gmcomment}[1]{}
\newcommand{\sfcomment}[1]{}
\newcommand{\sgacomment}[1]{}

\newcommand{\nl}[1]{\texttt{\small{\textcolor{blue}{#1}}}}
\newcommand{\NEMO}{\textit{NEMO}\xspace}

\newcommand{\hf}[1]{\textit{#1.h90}\index{h90 file!#1}}
\newcommand{\ifile}[1]{\textit{#1.nc}\index{Input NetCDF files!#1.nc}}
\newcommand{\jp}[1]{\textit{#1}\index{Model parameters!#1}}
\newcommand{\key}[1]{\textbf{key\_#1}\index{CPP keys!key\_#1}}
\newcommand{\mdl}[1]{\textit{#1.F90}\index{Modules!#1}}
\newcommand{\ngn}[1]{\textit{#1}\index{Namelist Group Name!#1}}
\newcommand{\np}[1]{\textit{#1}\index{Namelist variables!#1}}
\newcommand{\rou}[1]{\textit{#1}\index{Routines!#1}}

\newcommand{\grad}{\nabla}
\newcommand{\gradh}{\nabla_h}

\newcommand{\ew}[3]{{e_{3#1}}_{\,#2}^{\,#3} }
\newcommand{\vect}[1]{\ensuremath{\mathbf{#1}}}
\newcommand{\Div}{\grad\cdot}
\newcommand{\curl}{\nabla \times}
\newcommand{\pd}[2][]{\frac{\partial #1}{\partial #2}}
\newcommand{\alpbet} {\left(\alpha / \beta \right)}

\newcommand{\triad}[6][]{\ensuremath{{}_{#2}^{#3}{\mathbb{#4}_{#1}}_{#5}^{\,#6}}}
\newcommand{\triadd}[5]{\ensuremath{{}_{#1}^{#2}{\mathbb{#3}}_{#4}^{\,#5}}}
\newcommand{\triadt}[5]{\ensuremath{{}_{#1}^{#2}{\tilde{\mathbb{#3}}}_{#4}^{\,#5}}}
\newcommand{\rtriad}[2][]{\ensuremath{\triad[#1]{i}{k}{#2}{i_p}{k_p}}}
\newcommand{\rtriadt}[1]{\ensuremath{\triadt{i}{k}{#1}{i_p}{k_p}}}

\newcommand{\Alts}{{A}}
\newcommand{\Alt}{{A^{lT}}}

\newcommand{\rMLt}[1][i]{\tilde{r}_{\mathrm{ML}\,#1}}
\newcommand{\rML}[1][i]{r_{\mathrm{ML}\,#1}}

\newcommand{\mygstrut}[2]{\rule[#1 em]{0pt}{#2 em}}
\newcommand{\mystrut}{\rule[-.9 em]{0pt}{1.79 em}}

\newcommand{\doi}[1]{\href{http://dx.doi.org/#1}{full-text}}
