source: branches/2017/dev_merge_2017/DOC/texfiles/preamble.tex @ 9373

Last change on this file since 9373 was 9373, checked in by nicolasmartin, 2 years ago

Global reorganisation of DOC directory: files/folders renaming

File size: 8.8 KB
Line 
1\documentclass[a4paper,11pt]{book}
2%\documentclass[a4paper,11pt,makeidx]{book} <== may need this to generate index
3
4%  makeindex NEMO_book  <== to regenerate the index
5%  bibtex    NEMO_book  <== to generate  the bibliography
6
7%% Silence package: filter output messages and warnings
8\usepackage{silence}
9%%% LaTeX warnings: package and label
10\WarningFilter*{latex}{Package}
11\WarningFilter*{latex}{Label}
12%%% minitoc hints
13\WarningFilter{minitoc(hints)}{W0023}
14\WarningFilter{minitoc(hints)}{W0024}
15\WarningFilter{minitoc(hints)}{W0028}
16\WarningFilter{minitoc(hints)}{W0030}
17%%% natbib citation warning "Citation ... multiply defined"
18\WarningFilter*{natbib}{Citation}
19%%% Filter all warnings
20%\WarningsOff*
21
22\usepackage{graphicx}                            % allows insertion of pictures
23\graphicspath{{figures/}}                                  % Set global directory for pictures
24%\usepackage[capbesideposition={top,center}]{floatrow}      % allows captions
25%\floatsetup[table]{style=plaintop}                         % beside pictures
26\usepackage[margin=10pt,font={small},                      % Gives small font for captions
27labelsep=colon,labelfont={bf}]{caption}                    %
28\usepackage{enumitem}                                      % allows non-bold description items
29\usepackage{longtable}                                     % allows multipage tables
30
31%hyperref
32\usepackage[obeyspaces]{url}
33\usepackage[pdftitle={NEMO ocean engine},pdfauthor={Gurvan Madec},pdfstartview=FitH,
34bookmarks=true,bookmarksopen=true,breaklinks=true,colorlinks=true,
35linkcolor=blue,anchorcolor=blue,citecolor=blue,filecolor=blue,menucolor=blue,urlcolor=blue]{hyperref}
36% pdfsubject={The preprint document class
37%   elsart},% pdfkeywords={diapycnal diffusion,numerical mixing,z-level models},%%  usage of exteranl hyperlink :  \href{mailto:my_address@wikibooks.org}{my\_address@wikibooks.org}
38%                                                 \url{http://www.wikibooks.org}
39%                                     or         \href{http://www.wikibooks.org}{wikibooks home}
40
41
42%%%% page styles etc................
43\usepackage{fancyhdr}
44\pagestyle{fancy}
45% with this we ensure that the chapter and section
46% headings are in lowercase.
47\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
48\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
49\fancyhf{}             % delete current setting for header and footer
50\fancyhead[LE,RO]{\bfseries\thepage}
51\fancyhead[LO]{\bfseries\hspace{-0em}\rightmark}
52\fancyhead[RE]{\bfseries\leftmark}
53\renewcommand{\headrulewidth}{0.5pt}
54\renewcommand{\footrulewidth}{0pt  }
55\addtolength{\headheight}{2.6pt}   % make space for the rule
56%\addtolength{\headheight}{1.6pt}   % make space for the rule
57% get rid of headers on plain pages
58\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}}
59
60
61%%%%  Section number in Margin.......
62% typeset the number of each section in the left margin, with the start of each instance of
63% sectional heading text aligned with the left hand edge of  the body text.
64\makeatletter
65\def\@seccntformat#1{\protect\makebox[0pt][r]{\csname the#1\endcsname\quad}}
66\makeatother
67
68% Leave blank pages completely empty, w/o header
69\makeatletter
70\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
71  \hbox{}
72  \vspace*{\fill}
73  \vspace{\fill}
74  \thispagestyle{empty}
75  \newpage
76  \if@twocolumn\hbox{}\newpage\fi\fi\fi}
77\makeatother
78
79%%%% define the chapter  style ................
80\usepackage{minitoc}          %In French : \usepackage[french]{minitoc}
81%\usepackage{mtcoff}          % invalidate the use of minitocs
82\usepackage{fancybox}
83
84\makeatletter
85\def\LigneVerticale{\vrule height 5cm depth 2cm\hspace{0.1cm}\relax}
86\def\LignesVerticales{%
87  \let\LV\LigneVerticale\LV\LV\LV\LV\LV\LV\LV\LV\LV\LV}
88\def\GrosCarreAvecUnChiffre#1{%
89  \rlap{\vrule height 0.8cm width 1cm depth 0.2cm}%
90 \rlap{\hbox to 1cm{\hss\mbox{\color{white} #1}\hss}}%
91  \vrule height 0pt width 1cm depth 0pt}
92\def\GrosCarreAvecTroisChiffre#1{%
93  \rlap{\vrule height 0.8cm width 1.6cm depth 0.2cm}%
94 \rlap{\hbox to 1.5cm{\hss\mbox{\color{white} #1}\hss}}%
95  \vrule height 0pt width 1cm depth 0pt}
96
97\def\@makechapterhead#1{\hbox{%
98   \huge
99    \LignesVerticales
100    \hspace{-0.5cm}%
101    \GrosCarreAvecUnChiffre{\thechapter}
102    \hspace{0.2cm}\hbox{#1}%
103%    \GrosCarreAvecTroisChiffre{\thechapter}
104%    \hspace{1cm}\hbox{#1}%
105%}\par\vskip 2cm}
106}\par\vskip 1cm}
107\def\@makeschapterhead#1{\hbox{%
108   \huge
109    \LignesVerticales
110    %\hspace{0.5cm}%
111    \hbox{#1}%
112}\par\vskip 2cm}
113\makeatother
114
115%\def\thechapter{\Roman{chapter}}      % chapter number to be Roman
116
117
118%%%%           Mathematics...............
119%\documentclass{amsart}
120\usepackage{xspace}                              % helpd ensure correct spacing after macros
121\usepackage{latexsym,amssymb,amsmath}
122\allowdisplaybreaks[1]           % allow page breaks in the middle of equations
123\usepackage{texfiles/styles/NEMO_manual}    % use maths shortcuts
124
125\usepackage{times}             % use times font for text
126%\usepackage{mathtime}                          % font for illustrator to work (belleek fonts )
127%\usepackage[latin1]{inputenc}                % allows some unicode removed (agn)
128
129
130%%% essai commande
131\newcommand{\nl}[1]{\texttt{\small{\textcolor{blue}{#1}}}}
132\newcommand{\nlv}[1]{\texttt{\footnotesize#1}\xspace}
133\newcommand{\smnlv}[1]{\texttt{\scriptsize#1}\xspace}
134
135%%%% namelist & code display................................
136\usepackage{alltt,verbatim}   %%  alltt & verbatim for namelist
137% namelists
138\newcommand{\namdisplay}[1]{\begin{alltt}{\tiny\verbatiminput{namelists/#1}}\end{alltt}\vspace{-10pt}}
139\newcommand{\namtools}[1]{\begin{alltt}{\tiny\verbatiminput{namelists/#1}}\end{alltt}\vspace{-10pt}}
140% code display
141\newcommand{\codedisplay} [1] {\begin{alltt}{\tiny {\begin{verbatim} {#1}} \end{verbatim}} \end{alltt}      }
142
143
144
145%%%% commands for working with text................................
146% command to "comment out" portions of text ({} argument) or not ({#1} argument)
147\newcommand{\amtcomment}[1]{}    % command to "commented out" portions of text or not (#1 in argument)
148\newcommand{\sgacomment}[1]{}    % command to "commented out" portions of
149\newcommand{\gmcomment}[1]{}     % command to "commented out" portions of
150\newcommand{\sfcomment}[1]{}     % command to "commented out" portions of
151%                                               % text that span line breaks
152%Red (NR) or Yellow(WARN)
153%\newcommand{\NR}   {\colorbox{red}   {#1}}
154%\newcommand{\WARN} {\colorbox{yellow}{#1}}
155
156
157
158%%% index commands......................
159\usepackage{makeidx}
160%\usepackage{showidx}            % show the index entry
161
162\newcommand{\mdl}[1]{\textit{#1.F90}\index{Modules!#1}}  %module (mdl)
163\newcommand{\rou}[1]{\textit{#1}\index{Routines!#1}}  %module (routine)
164\newcommand{\hf}[1]{\textit{#1.h90}\index{h90 file!#1}}  %module (h90 files)
165\newcommand{\ngn}[1]{\textit{#1}\index{Namelist Group Name!#1}}   %namelist name (nampar)
166\newcommand{\np}[1]{\textit{#1}\index{Namelist variables!#1}}        %namelist variable
167\newcommand{\jp}[1]{\textit{#1}\index{Model parameters!#1}} %model parameter (jp)
168\newcommand{\pp}[1]{\textit{#1}\index{Model parameters!#1}}    %namelist parameter (pp)
169\newcommand{\ifile}[1]{\textit{#1.nc  }\index{Input NetCDF files!#1.nc}}   %input NetCDF files (.nc)
170\newcommand{\key}[1]{\textbf{key\_#1}\index{CPP keys!key\_#1}} %key_cpp (key)
171\newcommand{\NEMO}{\textit{NEMO}\xspace}  %NEMO (nemo)
172
173%%%%   Bibliography   .............
174\usepackage[nottoc,notlof,notlot]{tocbibind}
175\usepackage[square,comma]{natbib}
176\bibpunct{[}{]}{,}{a}{}{;}                           %suppress "," after "et al."
177\providecommand{\bibfont}{\small}
178
179\usepackage{subfiles}                          % Separate compilation of chapters from whole manual
180%\newcommand{\onlyinsubfile}[1]{#1}             % New commands for printing parts according to
181%\newcommand{\notinsubfile}[1]{}                % the file being compiled
182% Commands to use in the documentfile
183%\renewcommand{\onlyinsubfile}[1]{}                      % Appears only if chapter   .tex file is compiled
184%\renewcommand{\notinsubfile}[1]{#1}                     %    "    ""   "" NEMO_book .tex file is compiled
185
186\DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it}
187
188\usepackage{hyphenat}
189\hyphenation{AGRIF FORTRAN NEMOVAR bi-laplacian off-line on-line sea-ice well-known}
190
191%% Add source code highlighting
192%% From LaTeX Wikibooks https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings
193\usepackage{listings}
194\usepackage{xcolor}
195%% Colors from Trac default style
196\definecolor{backgroundcode}{HTML}{f8f8f8}
197\definecolor{graycode}{HTML}{666666}
198\definecolor{greencode}{HTML}{008800}
199\definecolor{purplecode}{HTML}{AA22FF}
200\definecolor{redcode}{HTML}{BB4444}
201\definecolor{yellowcode}{HTML}{B8860B}
202\lstset{language=[90]Fortran,
203  backgroundcolor=\color{backgroundcode},
204  basicstyle=\tiny,
205  breaklines=true,
206  commentstyle=\color{greencode},
207  identifierstyle=\color{yellowcode},
208  keywordstyle=\color{purplecode},
209  numberstyle=\color{graycode},
210  stringstyle=\color{redcode},
211  title=\lstname,
212}
Note: See TracBrowser for help on using the repository browser.