From e43e6e04922bbabb7c8e21694d6d403c23f55da8 Mon Sep 17 00:00:00 2001
From: Thomas Lambert <t.lambert@uliege.be>
Date: Fri, 23 Sep 2022 23:16:30 +0200
Subject: [PATCH] feat(nomencl): add nomenclature

---
 .gitignore        |  5 +++++
 latexmkrc         |  8 +++++++-
 preamble.tex      |  1 +
 rotare-doc.tex    |  4 ++++
 style/symbols.sty | 12 ++++++++++++
 5 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index c3bf7bc..39586c4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,6 +49,11 @@
 ### List of fixmes (from fixme package)
 *.lox
 
+### Nomenclature
+*.nlg
+*.nlo
+*.nls
+
 ### Ignore compiled pdfs
 *.pdf
 !figures/*/*.pdf
diff --git a/latexmkrc b/latexmkrc
index 57d3cdf..8d95c4a 100644
--- a/latexmkrc
+++ b/latexmkrc
@@ -17,4 +17,10 @@ $pdf_mode = 4;  # 1: use pdflatex, 4: use lualatex, 5 use xelatex
 $bibtex_use = 2;
 
 # Extra extensions to clean
-$clean_ext = 'synctex.gz synctex.gz(busy) run.xml tex.bak bbl bcf fdb_latexmk run tdo %R-blx.bib lox'
+$clean_ext = 'synctex.gz synctex.gz(busy) run.xml tex.bak bbl bcf fdb_latexmk run tdo %R-blx.bib lox nlg nlo nls';
+
+# Make nomenclature
+add_cus_dep("nlo", "nls", 0, "nlo2nls");
+sub nlo2nls {
+    system("makeindex $_[0].nlo -s nomencl.ist -o $_[0].nls -t $_[0].nlg");
+}
diff --git a/preamble.tex b/preamble.tex
index fb68871..ca6ae5b 100644
--- a/preamble.tex
+++ b/preamble.tex
@@ -88,6 +88,7 @@
 \renewmenumacro{\directory}{pathswithfolder} % default: paths
 \usepackage[scale=2]{ccicons} % Icons for CC licenses
 \usepackage[nolinks]{qrcode} % QR codes
+\usepackage{siunitx} % SI units
 
 % For inkscape figures
 \usepackage{xifthen}
diff --git a/rotare-doc.tex b/rotare-doc.tex
index c091b22..fa2ec50 100644
--- a/rotare-doc.tex
+++ b/rotare-doc.tex
@@ -63,6 +63,10 @@ draft,            % toggle if draft version
 \tableofcontents			% display table of contents
 \cleardoublepage
 
+% Nomenclature
+\printnomenclature
+
+
 % Body
 % ***********************************************
 \pagenumbering{arabic}			% arabic page numbering
diff --git a/style/symbols.sty b/style/symbols.sty
index dfd3c4e..2532c37 100644
--- a/style/symbols.sty
+++ b/style/symbols.sty
@@ -3,12 +3,21 @@
 % This ensures coherence between all parts of the document and simplifies
 % maintenance or changes in the nomenclature.
 %
+% This package also generates directly the nomenclature
+%
 % Author: Thomas Lambert <t.lambert@uliege.be>
 % ULiege - Aeroelasticity and Experimental Aerodynamics
 % CC0 License
 % https://gitlab.uliege.be/thlamb/rotare-doc
 % ------------------------------------------------------------------------------
 
+% Generate nomenclature
+\RequirePackage[stdsubgroups]{nomencl}
+\makenomenclature
+\newcommand{\nomunit}[1]{%
+  \renewcommand{\nomentryend}{\hspace*{\fill}\si{#1}}%
+}
+% TODO better spacing/title style
 
 % --- Velocities ---------------------------------------------------------------
 
@@ -42,6 +51,9 @@
 
 % --- Others -------------------------------------------------------------------
 \newcommand{\area}{\ensuremath{A}} % (Rotor) Area
+\nomenclature[A]{\area}{Area\nomunit{\m^2}}
+
+
 \newcommand{\radius}{\ensuremath{R}} % Rotor radius
 \newcommand{\rRad}{\ensuremath{r}} % Nondimensional radial position along the blade
 \newcommand{\aRad}{\ensuremath{y}} % Radial distance along the blade
-- 
GitLab