[Tex/LaTex] Converting a Nomenclature Example to Use Glossaries

glossariesnomenclature

I am hoping to get pointers for how to convert this example to use the glossaries package:

How to achieve nomenclature entries like: symbol, Description, Dimension and unit, etc?

The aforementioned post is exactly what I want, but I prefer glossaries as it is built-in to the wrapper I use (Latexian) to generate the pdf.

What steps would I need to take to 'rewrite' this?

Edit:
MWE Layout, but non-working code:

Nomenclature

Acronyms
Symbol  Description     % no Dimensions and Units 
EVRA    Euler Vector Rotation Angle
...

Greek Symbols
Symbol  Description             Dimensions     Units
alpha    angle of attack        1 or (-)       radians                 
...

Roman Symbols
Symbol  Description             Dimensions     Units
S       Surface area vector     L^2            m^2
...

Superscripts
Symbol  Description     % no Dimensions and Units 
b       bottom surface 
...

Dimensionless Numbers
Symbol  Description     Definition
Re      reynolds number  equation
...

\documentclass{article}
\usepackage{longtable}
\usepackage{siunitx}
\usepackage[acronym]{glossaries}
etc.

\newcommands % make it easy to add each type of nomenclature

\makeglossaries
\begin{document}
 bunch of stuff \superscript[A]{\(A\)}{a dimensionless coefficient}{--}{1}

 more stuff \acronym[EVRA]{\(EVRA\)}{Euler Vector Rotation Angle}

 \printglossary[title=Nomenclature]

\end{document}

Best Answer

The way I would tackle this:

  1. I would create keys for the new types of columns to be created
  2. I would define the terns for the various types of nomenclature
  3. Print the specific glossaries
  4. Ensure your command line compile sequence has the additional makeindex calls
  5. Create a custom style for your glossary components, and use the newly created field keys to insert the information such as units, definitions, and dimensions.
  6. Recognize when you can reuse these styles
  7. Pay attention to the definitions of first={} in the \newglossaryentry{} because if it is absent, only the name will be used (possibly desired), but watch the result of this formatting carefully in your final document.

Comment/Note: I haven't explored how this solution would change when not exclusively the \gls{} commands in your tex. I prefer to use the \gls{} everywhere even though there is an acronym command already defined. I find this gives me flexibility when the glossary entry is being bounced around different types of glossaries.

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{longtable,floatrow,booktabs}
\usepackage{siunitx,microtype,textcomp,textgreek}
\usepackage[nogroupskip,toc,indexonlyfirst]{glossaries}


%=============================================================================
%   G L O S S A R Y   S E T U P
%=============================================================================


\glsaddkey
{unit}          % new key
{\relax}        % default value if "unit" isn't used in \newglossaryentry
{\glsentryunit} % analogous to \glsentrytext
{\Glsentryunit} % analogous to \Glsentrytext
{\glsunit}      % analogous to \glstext
{\Glsunit}      % analogous to \Glstext
{\GLSunit}      % analogous to \GLStext

\glsaddkey
{dimension}     % new key
{\relax}            % default value if "dimension" isn't used in \newglossaryentry
{\glsentrydim}      % analogous to \glsentrytext
{\Glsentrydim}      % analogous to \Glsentrytext
{\glsdim}           % analogous to \glstext
{\Glsdim}           % analogous to \Glstext
{\GLSdim}           % analogous to \GLStext

\glsaddkey
{def}       % new key
{\relax}            % default value if "prerequisite" isn't used in \newglossaryentry
{\glsentrydef}      % analogous to \glsentrytext
{\Glsentrydef}      % analogous to \Glsentrytext
{\glsdef}           % analogous to \glstext
{\Glsdef}           % analogous to \Glstext
{\GLSdef}           % analogous to \GLStext

\newglossary[alg]{acronym}{acr}{acn}{List of Acronyms}% if not using the acronyms package option - can declare it myself
\newglossary[nlgG]{notationGreek}{notG}{ntnG}{Greek Symbols}
\newglossary[nlgR]{notationRoman}{notR}{ntnR}{Roman Symbols}
\newglossary[dnlg]{dimensionlessNumber}{dnt}{dntn}{Dimensionless Numbers}
\newglossary[sslg]{superscript}{sst}{sstn}{Superscripts}

% please note these should be accompanied by command line calls to makeindex eg:

% "%MikTexPath%makeindex.exe" -s "main.ist" -t "main.glg"  -o "main.gls"  "main.glo"
% "%MikTexPath%makeindex.exe" -s "main.ist" -t "main.alg"  -o "main.acr"  "main.acn"
% "%MikTexPath%makeindex.exe" -s "main.ist" -t "main.nlgG" -o "main.notG" "main.ntnG"
% "%MikTexPath%makeindex.exe" -s "main.ist" -t "main.nlgR" -o "main.notR" "main.ntnR"
% "%MikTexPath%makeindex.exe" -s "main.ist" -t "main.dnlg" -o "main.dnt"  "main.dntn"
% "%MikTexPath%makeindex.exe" -s "main.ist" -t "main.sslg" -o "main.sst"  "main.sstn"


%==================================================================================================================================================================

%http://tex.stackexchange.com/questions/78016/questions-regarding-conversion-from-acronym-package-to-glossaries
%http://tex.stackexchange.com/questions/71549/how-can-i-repeat-the-header-but-not-the-caption-with-longtable
%http://tex.stackexchange.com/questions/8946/how-to-combine-acronym-and-glossary
%http://tex.stackexchange.com/questions/26563/problems-with-glossaries-package-see-attribute

%http://tex.stackexchange.com/questions/126323/glossaries-list-only-page-number-of-the-first-occurrence

%\renewcommand*{\glspostdescription}{}%removes dot at end

\floatsetup[table]{style=ruled,
    objectset=raggedright,
    margins=raggedright,
    midcode=captionskip,
    captionskip=10pt}

\newglossarystyle{custom_acronyms}
{
    \setglossarystyle{long3colheader}%
    \renewcommand*{\glossaryheader}{%

        %\toprule
        Symbol & Description 
        \tabularnewline
        \midrule
        \endhead

        %\bottomrule
        \endfoot
    }%
    \setlength\glsdescwidth{.4\textwidth}%
    \setlength\glspagelistwidth{.95\textwidth}%
    \renewcommand{\glossentry}[2]{\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & \glossentrydesc{##1}
        \tabularnewline
    }%
}

\newglossarystyle{custom_symbols}
{
    \setglossarystyle{long4colheader}%
    \renewcommand*{\glossaryheader}{%

        %\toprule
        Symbol & Description & Dimensions & Units
        \tabularnewline
        \midrule
        \endhead

        %\bottomrule
        \endfoot
    }%
    \setlength\glsdescwidth{.4\textwidth}%
    \setlength\glspagelistwidth{.95\textwidth}%
    \renewcommand{\glossentry}[2]{\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & \glossentrydesc{##1} & \glsentrydim{##1} & \glsentryunit{##1} 
        \tabularnewline
    }%
}

\newglossarystyle{custom_dimlessnum}
{
    \setglossarystyle{long3colheader}%
    \renewcommand*{\glossaryheader}{%

        %\toprule
        Symbol & Description & Definition
        \tabularnewline
        \midrule
        \endhead

        %\bottomrule
        \endfoot
    }%
    \setlength\glsdescwidth{.4\textwidth}%
    \setlength\glspagelistwidth{.95\textwidth}%
    \renewcommand{\glossentry}[2]{\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} & \glossentrydesc{##1} & \glsentrydef{##1}
        \tabularnewline
    }%
}

%==================================================================================================================================================================



\newglossaryentry{EVRA}{ type={acronym}, sort={EVRA},  name={EVRA}, short={EVRA}, long={Euler Vector Rotation Angle}, first={Euler Vector Rotation Angle (EVRA)}, description={Euler Vector Rotation Angle} }

\newglossaryentry{EVA}{ type={acronym}, sort={EVA},  name={EVA}, short={EVA}, long={Extra Vehicular Activity}, first={Extra Vehicular Activity (EVA)}, description={Extra Vehicular Activity} }

\newglossaryentry{angle of attack}{ type={notationGreek}, name={\textalpha}, first={angle of attack (\textalpha)}, description={angle of attack}, dimension={1 or (-)}, unit={radians} }

\newglossaryentry{SAvector}{ type={notationRoman}, name={S},description={Surface area vector}, first={surface area vector (S)}, dimension={\si{L^2}}, unit={\si{m^2}}}

\newglossaryentry{bS}{ type={superscript}, name={bS},description={bottom surface} }

\newglossaryentry{Re}{ type={dimensionlessNumber}, name={Re}, description={reynolds nummber}, def={math mode equation } }


\makeglossaries
\begin{document}
    \noindent
    Begin document:

    First example is of an acronym:  Could call \gls{EVRA} and we would see the expansion.  \Gls{EVRA} again yields just the abbreviation.  Another acronym is \gls{EVA}
    \medskip

    Example of a greek symbol with dimensions and units \gls{angle of attack}
    \medskip

    Roman symbol example:  \gls{SAvector}, and \gls{SAvector}
    \medskip

    Superscript examble \gls{bS} (if included in the formula with the gls command, the  glossary can hyperlink to the use and automate the population of your superscript list )
    \medskip

    Dimensionless number such as reynolds number \gls{Re}


    \printglossary[type=acronym,style=custom_acronyms]
    \printglossary[type=notationGreek,style=custom_symbols]
    \printglossary[type=notationRoman,style=custom_symbols]
    \printglossary[type=superscript,style=custom_acronyms]
    \printglossary[type=dimensionlessNumber,style=custom_dimlessnum]
    %\printglossary[type=main]

\end{document}