New URL for NEMO forge!

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.
indexes.tex in NEMO/trunk/doc/latex/global – NEMO

source: NEMO/trunk/doc/latex/global/indexes.tex @ 11577

Last change on this file since 11577 was 11577, checked in by nicolasmartin, 4 years ago

New LaTeX commands \nam and \np to mention namelist content
(Partial commit to serve as a backup before other large edits)
In order to benefit of the syntax highlighting and to have a simpler syntax for
citing namelist block (\nam) and parameter (\np) with an optional variable assignment (\forcode{...}),
at this time the only viable solution I found is to require a double marker for
what it looks like the same item:

  1. Marker with the real name: 'tra_adv' block or 'ln_flx' parameter
  2. Marker with underscore character escaping: 'tra\_adv' block or 'ln\_flx' parameter

Despite many searches and attempts, I did not find a workaround to edit on-the-fly one or
the other marker.
In fact, the problem is on one side that the LaTeX index interprets '_' as a switch for lowering like
in math mode while on the other hand the backslash is considered for Pygments as a typo in Fortran
(red box).

For instance, \nam and \np have as of now the aforementioned 2 mandatory arguments in
the previous order (between braces) + an optional argument for \np when the parameter is defined
(between brackets at the first position):

  • \nam: LaTeX code in the \nam{tra_adv}{tra\_adv} -> PDF ' in the &namtra_adv (namelist X.X) ' with syntax highlighting, the hyperlink and the index entry
  • \np: LaTeX code \np[=.true.]{ln_flx}{ln\_flx} -> PDF ln_flux=.true. with syntax highlighting for the whole string and the entry in the 'parameters' index
File size: 1.5 KB
4%% Naming customization
6\renewcommand{\listlistingname}{List of Namelists}
8%% Index entries (italic font for files, preformat for code)
9\newcommand{\hf}[1]{   \index{h90 files!#1}             \textit{#1.h90}          }
10\newcommand{\ifile}[1]{\index{Input NetCDF files!} \textit{}           }
11\newcommand{\jp}[1]{   \index{Model parameters!#1}      \texttt{#1}              }
12\newcommand{\key}[1]{  \index[keys]{#1@\texttt{\textbf{key\_#1}}} \texttt{\textbf{key\_#1}}}
13\newcommand{\mdl}[1]{  \index[modules]{#1@\textit{#1.F90}}        \textit{#1.F90}          }
14\newcommand{\nam}[2]{  \index[blocks]{\texttt{\&nam#2}}   \forcode{&nam#1} (\autoref{lst:nam#1})         }
15\newcommand{\np}[3][]{\index[parameters]{\texttt{#3}}       \forcode{#2#1}           }
16%\newcommand{\nam}[1]{  \index[blocks]{\texttt{\&nam#1}}           \forcode{&nam#1}         }
17%\newcommand{\np}[1]{   \index[parameters]{\texttt{#1}}            \forcode{#1}              }
18\newcommand{\rou}[1]{  \index[subroutines]{#1@\texttt{#1}}        \texttt{#1}              }
21\indexsetup{toclevel=section, othercode=\small}
23\makeindex[intoc=true, name=blocks     , title=Namelist blocks      , columns=3]
24\makeindex[intoc=true, name=keys       , title=CPP keys                        ]
25\makeindex[intoc=true, name=modules    , title=\fortran\ modules    , columns=3]
26\makeindex[intoc=true, name=parameters , title=Namelist parameters  , columns=3]
27\makeindex[intoc=true, name=subroutines, title=\fortran\ subroutines           ]
Note: See TracBrowser for help on using the repository browser.