1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
% This file is public domain. See the "Examples" chapter
% in the bib2gls user manual for a more detailed description
% of this file.
\documentclass[12pt,a4paper]{report}
\usepackage{siunitx}
\usepackage[record,% use bib2gls
nostyles,% don't load default styles
% load glossary-tree.sty and glossary-longbooktabs.sty and patch:
stylemods={tree,longbooktabs},
style=alttree]{glossaries-extra}
\newglossary*{units}{Units of Measurement (by SI unit)}
\GlsXtrLoadResources[
% data in baseunits.bib and derivedunits.bib:
src={baseunits,derivedunits},
field-aliases={
unitname=name,
unitsymbol=symbol,
measurement=description
},
symbol-sort-fallback={name},
selection=all,% select all entries
% make @measurement and @unit act like @dualsymbol:
entry-type-aliases={
measurement=dualsymbol,
unit=dualsymbol,
},
set-widest,% needed for alttree style
dual-sort={letternumber-upperlower},
type=main,% put primary entries in 'main' glossary
dual-type={units}% put dual entries in 'units' glossary
]
\setlength{\glsdescwidth}{.4\hsize}
% define custom glossary style
\newglossarystyle{units}% style name
{% base it on long3col-booktabs
\setglossarystyle{long3col-booktabs}%
\renewcommand*{\glossaryheader}{%
\toprule
\bfseries Name &
\bfseries Measurement &
\bfseries Symbol
\tabularnewline\midrule\endhead
\bottomrule\endfoot}%
% main entries:
\renewcommand{\glossentry}[2]{%
\glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
\glossentrydesc{##1}\glspostdescription &
\glossentrysymbol{##1}\tabularnewline
}%
}
\begin{document}
\printunsrtglossary[title={SI Units of Measurement},
style={units}]
\printunsrtglossary[type=units]
\end{document}
|