I'm trying to produce a list of symbols for my PhD thesis including a column with the units of the symbols. Therefore, I used the latex code provided in the following link: glossaries: add additional column for units.
Minimum Working Example (MWE):
\documentclass[11pt, pdftex]{scrreprt}
% ---- packages: ---------------
\usepackage[LGR,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{substitutefont}
\usepackage{newtxtext}
\usepackage{newtxmath}
\substitutefont{LGR}{\rmdefault}{Tempora}
\usepackage{siunitx}
\usepackage{amsmath}
\usepackage[pdftex]{hyperref}
\usepackage[
nogroupskip,
acronym,
nomain,
nopostdot,
sort=standard,
automake,
xindy,
]
{glossaries-extra}
\usepackage{glossary-longbooktabs}
\setabbreviationstyle[acronym]{long-short}
\setlength{\glsdescwidth}{18cm}
% -- new style for list of symbols: ----
\newglossarystyle{symbunitlong}{
\setglossarystyle{long3col} % base this style on the list style
\renewenvironment{theglossary}{ % Change the table type --> 3 columns
\begin{longtable}{lp{0.5\glsdescwidth}>{\centering\arraybackslash}p{2cm}}}
{\end{longtable}}
\renewcommand*{\glossaryheader}{% Change the table header
\bfseries Sign & \bfseries Description & \bfseries Unit \\
\hline
\addlinespace[7mm]
\endhead}
\renewcommand*{\glossentry}[2]{% Change the displayed items
\glstarget{##1}{\glossentryname{##1}} %
& \glossentrydesc{##1}% Description
& \glsunit{##1} \tabularnewline
\addlinespace[2mm]}
}
% --- define symbollist: ------
\newglossary[slg]{symbolslist}{syi}{syg}{List of Symbols}
% include third column in list of symbols for units:
\glsaddkey{unit}{\glsentrytext{\glslabel}}{\glsentryunit}{\GLsentryunit}{\glsunit}{\Glsunit}{\GLSunit}
\makeglossaries
\glssetcategoryattribute{acronym}{glossdesc}{firstuc}
% -------------------------------------------
% define some symbols:
\newglossaryentry{symb:lambda}{
name={\ensuremath{\lambda}},
sort={z_lambda},
description={Thermal conductivity},
unit={\si{\frac{W}{m \cdot K}}},
type=symbolslist
}
\newglossaryentry{symb:Pc}{
name={\ensuremath{P_{\mathrm{C}}}},
sort={PC},
description={Carnot power},
unit={\si{W}},
type=symbolslist
}
\newglossaryentry{symb:Qjoule}{
name={\ensuremath{\dot{Q}_\mathrm{J}}},
sort={Qjoule},
description={Joule heating},
unit={\si{W}},
type=symbolslist
}
% -------------------------------------------
% define some abbreviations:
\newacronym{acro:FCL}{FCL}{fault current limiters}
\newacronym{acro:SS}{SS}{stainless steel}
% -------------------------------------------
\begin{document}
\textbf{First page:}
\begin{itemize}
\item use of symbols \gls{symb:Qjoule} and \gls{symb:Pc}
\item use of abbreviation: \gls{acro:SS}
\end{itemize}
\newpage
\textbf{Second page:}
\begin{itemize}
\item use of symbol \gls{symb:lambda}
\item use of abbreviation: \gls{acro:FCL}
\end{itemize}
\newpage
% ---- list of symbols: -------
\printglossary[type=symbolslist, style=symbunitlong]
% ---- list of abbreviations: -------
\printglossary[title={List of Abbreviations}, type=acronym, style=listdotted]
\end{document}
It works so far (see MWE above), but now I intend to add a fourth column which indicates the first appearance/page of definition of the symbols. The final, desired state of my list of symbols should look like it is shown in the following screenshot:
And I just want to display the page number of the page where the respective symbol occurs for the first time in the text, not every page number where it is used. But unfortunately, I don’t really know how to do that and what I have to add in my defined glossary style.
Thank you very much for your help!
Edit:
I'm wondering if the question is not clear and I wasn't able to point out my problem or if it's just not possible to realize the intended thing and to add a fourth column which indicates only the first appearance/page of definition of the symbols.
Considering the related questions to my question, I suppose that the package option "indexonlyfirst" could help, but I don't know how to integrate that in detail.
Best Answer
If you use the
symbol
key instead of providing a new key for the units then thealtlongragged4col-booktabs
style is very similar to your desired format, so that would be a better starting point.I've trimmed down your example and provided the commands
\glsentryunit
etc that simply use thesymbol
field instead, in case you need them in your document.This produces:
which almost matches, except for the column alignment.
The
altlong4col-booktabs
style is defined as:This in turn uses
long4col-booktabs
which sets up the header with:So if you don't want the top rule and bottom rule this can be redefined as well, and you may prefer to replace the commands
\entryname
,\symbolname
and\pagelistname
with your hard-coded values instead of having to redefine them.The patch
\glspatchLToutput
in thealtlong4col-booktabs
style is superfluous as it's already applied bylong4col-booktabs
, so it may be omitted.Here's the new style that combines the above:
The complete MWE is:
This produces:
The simplest way of increasing the gap between all the rows is to change
\arraystretch
. The default value is 1. The modification to the style below increases this to 1.5 (the change is localised so it won't affect any tables that come after the list of symbols).You can adjust this value as appropriate. The larger the value, the bigger the inter-row spacing.