# glossaries: How to customize list of symbols with additional column for units?

I want to add an additional column to the list of symbols for inserting the belonging units to the preceding variables.

In my case, it is necessary to use three different and independent glossary-lists (acronymslist, symbolslist and glossary) like shown below. However, the third column should be used only in the symbolslist.

Minimum Working Example (MWE):

\documentclass{scrbook}                           % documentclass: scrbook
\usepackage[acronym,toc]{glossaries}              % use glossaries-package

\makeglossaries                                   % activate glossaries-package

% ==== EXEMPLARY ENTRY FOR SYMBOLS LIST =========================================
\newglossaryentry{symb:Pi}{name=\ensuremath{\pi},
description={Geometrical value},
type=symbolslist}

% ==== EXEMPLARY ENTRY FOR ACRONYMS LIST ========================================
\newacronym{VRBD}{VRBD}{Violet-Red-Bile-Glucose-Agar}

% ==== EXEMPLARY ENTRY FOR MAIN GLOSSARY ========================================
\newglossaryentry{Biofouling}{name=Biofouling,description={Some description}}

\begin{document}

\printglossary[type=\acronymtype,style=long]  % list of acronyms
\printglossary[type=symbolslist,style=long]   % list of symbols
\printglossary[type=main]                     % main glossary

\end{document}


Screenshot of the result:

As expected, this MWE creates three different types of lists what is entirely correct. Now, I want to add a third column only to the list of symbols for inserting the units. It would be great if we can create something beautiful like the following table-layout.

Screenshot of the final (desired) state:

I have borrowed this shapely layout from this topic. Unfortunately, the belonging MWE doesn't work together with scrbook-class. Is there any other possibility to expand my own code from the top to generate such a layout (including the hrule)?

Thank you very much for your help!

• If i replace on of the 3 entries with my custom entry then it generates 4 entries and wont remove the old one, even though it isnt in the code anymore. Why is that? Aug 1, 2020 at 18:43

I suggest to use a separate unit key for the symbol unit and refer to it with \glsunit. (Alternative: Use the user1...user6 keys for this feature)

In addition, this key must be used in the glossarystyle. I've defined a new style based on the already provided long3col style which displays the symbols in the requested order.

\documentclass{book}
\usepackage{siunitx}
\usepackage[acronym,toc]{glossaries}              % use glossaries-package

\setlength{\glsdescwidth}{15cm}

\makeglossaries                                   % activate glossaries-package

% ==== EXEMPLARY ENTRY FOR SYMBOLS LIST =========================================
\newglossaryentry{symb:Pi}{name=\ensuremath{\pi},
description={Geometrical value},
unit={},
type=symbolslist}

\newglossaryentry{height}{name=\ensuremath{h},
description={Height of tower},
unit={\si{m}},
type=symbolslist}

\newglossaryentry{energyconsump}{name=\ensuremath{P},
description={Energy consumption},
unit={\si{kW}},
type=symbolslist}

% ==== EXEMPLARY ENTRY FOR ACRONYMS LIST ========================================
\newacronym{VRBD}{VRBD}{Violet-Red-Bile-Glucose-Agar}

% ==== EXEMPLARY ENTRY FOR MAIN GLOSSARY ========================================
\newglossaryentry{Biofouling}{name=Biofouling,description={Some description}}

\newglossarystyle{symbunitlong}{%
\setglossarystyle{long3col}% base this style on the list style
\renewenvironment{theglossary}{% Change the table type --> 3 columns
\begin{longtable}{lp{0.6\glsdescwidth}>{\centering\arraybackslash}p{2cm}}}%
{\end{longtable}}%
%
\bfseries Sign & \bfseries Description & \bfseries Unit \\
\hline
\renewcommand*{\glossentry}[2]{%  Change the displayed items
\glstarget{##1}{\glossentryname{##1}} %
& \glossentrydesc{##1}% Description
& \glsunit{##1}  \tabularnewline
}
}

\begin{document}

\printglossary[type=\acronymtype,style=long]  % list of acronyms
\printglossary[type=symbolslist,style=symbunitlong]   % list of symbols
\printglossary[type=main]                     % main glossary

\end{document}


• I am sorry, but when I copy and paste your MWE, then compile it, I got nothing but a white page. What is the reason behind this?
– Diaa
Sep 5, 2017 at 11:01
• @DiaaAbidou: Have you run the makeglossaries script?
– user31729
Sep 5, 2017 at 11:04
• I am sorry, but what do you mean?
– Diaa
Sep 5, 2017 at 11:05
• @DiaaAbidou: You need to compile with pdflatex, then makeglossaries, then pdflatex again.
– user31729
Sep 5, 2017 at 11:05
• @DiaaAbidou: See the documentation and change \makenoidxglossaries into \makeglossaries
– user31729
Sep 5, 2017 at 11:20

Just adding to Christian's answer: to use the unit macros inside the \si{unit} command defined by siunitx such as \metre and \kilo\watt used in his MWE, one should add the command \glssetnoexpandfield{unit}` before setting any entries.

It is better explained in This Answer.