New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 9376 for branches/2017/dev_merge_2017/DOC/texfiles/preamble.tex – NEMO

Ignore:
Timestamp:
2018-03-06T17:12:34+01:00 (6 years ago)
Author:
nicolasmartin
Message:

Global reorganisation of DOC directory: refactoring & cleaning of TeX source code for readability

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2017/dev_merge_2017/DOC/texfiles/preamble.tex

    r9373 r9376  
    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 
    27 labelsep=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, 
    34 bookmarks=true,bookmarksopen=true,breaklinks=true,colorlinks=true, 
    35 linkcolor=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} 
     1%% ============================================================================== 
     2%% preamble.tex: Document layout,  
     3%% ============================================================================== 
    404 
    415 
    42 %%%% page styles etc................ 
    43 \usepackage{fancyhdr} 
     6%% Document layout 
     7%% ============================================================================== 
     8 
     9\documentclass[a4paper, 11pt]{book} 
     10 
     11 
     12%% LaTeX packages 
     13%% ============================================================================== 
     14 
     15\usepackage{natbib}     %% bib 
     16\usepackage{caption}    %% caption 
     17\usepackage{xcolor}     %% color 
     18\usepackage{silence}    %% compilation 
     19\usepackage{times}      %% font 
     20\usepackage{hyperref}   %% hyper 
     21\usepackage{enumitem}   %% list 
     22\usepackage{minted}     %% listing 
     23\usepackage{amsmath}    %% maths 
     24\usepackage{fancyhdr}   %% page 
     25\usepackage{minitoc}    %% toc 
     26\usepackage{subfiles}   %% subdocs 
     27 
     28 
     29%% Extensions in bundle package 
     30 
     31\usepackage{amssymb, graphicx, longtable, makeidx, xspace} 
     32 
     33 
     34%% Configuration 
     35%% ============================================================================== 
     36 
     37\captionsetup{margin=10pt, font={small}, labelsep=colon, labelfont={bf}} 
     38\graphicspath{{figures/}} 
     39\hypersetup{ 
     40   pdftitle={NEMO ocean engine}, pdfauthor={Gurvan Madec, and the NEMO team}, 
     41   colorlinks 
     42} 
     43 
     44 
     45%% Styles & Customization 
     46%% ============================================================================== 
     47 
    4448\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 
     49\usemintedstyle{emacs} 
     50\bibliographystyle{texfiles/styles/ametsoc} 
     51 
     52 
     53%% Additionnal fonts 
     54\DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it} 
     55 
     56 
     57%% Custom macros 
     58 
     59\usepackage{texfiles/styles/NEMO_manual} 
     60 
     61 
     62%% Page layout 
     63 
     64\fancyhf{} 
    5065\fancyhead[LE,RO]{\bfseries\thepage} 
    5166\fancyhead[LO]{\bfseries\hspace{-0em}\rightmark} 
     67\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}} 
    5268\fancyhead[RE]{\bfseries\leftmark} 
     69\renewcommand{\chaptermark}[1]{\markboth{#1}{}} 
    5370\renewcommand{\headrulewidth}{0.5pt} 
    5471\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}} 
     72\addtolength{\headheight}{2.6pt} 
    5973 
    6074 
    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. 
     75%% Chapters catcodes 
     76 
    6477\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 
     78\def\LigneVerticale{\vrule height 5cm depth 2cm\hspace{0.1cm}\relax} 
     79\def\LignesVerticales{\let\LV\LigneVerticale\LV\LV\LV\LV\LV\LV\LV\LV\LV\LV} 
     80\def\GrosCarreAvecUnChiffre#1{% 
     81   \rlap{\vrule height 0.8cm width 1cm depth 0.2cm}% 
     82   \rlap{\hbox to 1cm{\hss\mbox{\color{white} #1}\hss}}% 
     83   \vrule height 0pt width 1cm depth 0pt% 
     84} 
     85\def\@makechapterhead#1{ 
     86   \hbox{ 
     87      \huge\LignesVerticales 
     88      \hspace{-0.5cm} 
     89      \GrosCarreAvecUnChiffre{\thechapter} 
     90      \hspace{0.2cm} 
     91      \hbox{#1} 
     92   } 
     93   \par\vskip 
     941cm 
     95} 
     96\def\@makeschapterhead#1{ 
     97   \hbox{ 
     98      \huge\LignesVerticales 
     99      \hbox{#1} 
     100   } 
     101   \par\vskip 
     1022cm 
     103} 
    70104\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else 
    71105  \hbox{} 
     
    75109  \newpage 
    76110  \if@twocolumn\hbox{}\newpage\fi\fi\fi} 
     111\def\@seccntformat#1{\protect\makebox[0pt][r]{\csname the#1\endcsname\quad}} 
    77112\makeatother 
    78113 
    79 %%%% define the chapter  style ................ 
    80 \usepackage{minitoc}          %In French : \usepackage[french]{minitoc} 
    81 %\usepackage{mtcoff}          % invalidate the use of minitocs 
    82 \usepackage{fancybox} 
    83114 
    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} 
     115%% Indexing 
     116%% ============================================================================== 
    96117 
    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 } 
     118\makeindex 
Note: See TracChangeset for help on using the changeset viewer.