| 1 |
% This file is public domain. See the "Examples" chapter |
| 2 |
% in the bib2gls user manual for a more detailed description |
| 3 |
% of this file. |
| 4 |
|
| 5 |
\documentclass{scrreprt} |
| 6 |
|
| 7 |
\usepackage[T1]{fontenc} |
| 8 |
\usepackage[utf8]{inputenc} |
| 9 |
\usepackage[version=4]{mhchem} |
| 10 |
\usepackage{siunitx} |
| 11 |
\usepackage{etoolbox} |
| 12 |
\usepackage{marvosym} |
| 13 |
% package conflict, need to undefine conflicting commands |
| 14 |
\undef\Sun |
| 15 |
\undef\Lightning |
| 16 |
\usepackage[weather]{ifsym} |
| 17 |
|
| 18 |
\usepackage[en-GB]{datetime2} |
| 19 |
\usepackage[colorlinks]{hyperref} |
| 20 |
|
| 21 |
\usepackage[record,% use bib2gls |
| 22 |
section,% use \section* for glossary headings |
| 23 |
postdot,% insert dot after descriptions in glossaries |
| 24 |
nomain,% don't create 'main' glossary |
| 25 |
index,% create 'index' glossary |
| 26 |
nostyles,% don't load default styles |
| 27 |
% load and patch required style packages: |
| 28 |
stylemods={list,mcols,tree,bookindex} |
| 29 |
]{glossaries-extra} |
| 30 |
|
| 31 |
\newglossary*{bacteria}{Bacteria} |
| 32 |
\newglossary*{markuplanguage}{Markup Languages} |
| 33 |
\newglossary*{vegetable}{Vegetables} |
| 34 |
\newglossary*{mineral}{Minerals} |
| 35 |
\newglossary*{animal}{Animals} |
| 36 |
\newglossary*{chemical}{Chemical Formula} |
| 37 |
\newglossary*{baseunit}{SI Units} |
| 38 |
\newglossary*{measurement}{Measurements} |
| 39 |
\newglossary*{film}{Films} |
| 40 |
\newglossary*{book}{Books} |
| 41 |
\newglossary*{person}{People} |
| 42 |
\newglossary*{mediacontrol}{Media Control Symbols} |
| 43 |
\newglossary*{information}{Information Symbols} |
| 44 |
\newglossary*{weather}{Weather Symbols} |
| 45 |
|
| 46 |
\newcommand*{\bibglsdate}[7]{\DTMdisplaydate{#1}{#2}{#3}{#4}} |
| 47 |
|
| 48 |
\GlsXtrLoadResources[ |
| 49 |
src={no-interpret-preamble}, |
| 50 |
interpret-preamble=false |
| 51 |
] |
| 52 |
|
| 53 |
\GlsXtrLoadResources[ |
| 54 |
src={interpret-preamble,people}, |
| 55 |
field-aliases={ |
| 56 |
identifier=category, |
| 57 |
born=user1, |
| 58 |
died=user2, |
| 59 |
othername=user3 |
| 60 |
}, |
| 61 |
replicate-fields={name={first}}, |
| 62 |
type=person, |
| 63 |
save-locations=false, |
| 64 |
date-fields={user1,user2}, |
| 65 |
date-field-format={d MMM y G} |
| 66 |
] |
| 67 |
|
| 68 |
% Abbreviation styles must be set before the resource set |
| 69 |
% that defines the abbreviations: |
| 70 |
\setabbreviationstyle[bacteria]{long-only-short-only} |
| 71 |
\setabbreviationstyle[markuplanguage]{long-short-desc} |
| 72 |
|
| 73 |
% And also the style-dependent name format: |
| 74 |
\renewcommand*{\glsxtrlongshortdescname}{% |
| 75 |
\protect\glsabbrvfont{\the\glsshorttok}\space |
| 76 |
\glsxtrparen{\glslongfont{\the\glslongtok}}% |
| 77 |
} |
| 78 |
|
| 79 |
\GlsXtrLoadResources[ |
| 80 |
src={bacteria,markuplanguages,vegetables, |
| 81 |
minerals,animals,books,films}, |
| 82 |
field-aliases={ |
| 83 |
identifier=category, |
| 84 |
year=user1, |
| 85 |
cast=user2 |
| 86 |
}, |
| 87 |
type={same as category}, |
| 88 |
bibtex-contributor-fields={user2}, |
| 89 |
contributor-order={forenames}, |
| 90 |
save-locations=false |
| 91 |
] |
| 92 |
|
| 93 |
\GlsXtrLoadResources[ |
| 94 |
src={chemicalformula}, |
| 95 |
entry-type-aliases={chemical=symbol}, |
| 96 |
field-aliases={ |
| 97 |
identifier=category, |
| 98 |
formula=name, |
| 99 |
chemicalname=description, |
| 100 |
}, |
| 101 |
type={chemical}, |
| 102 |
set-widest, |
| 103 |
sort={letternumber-case}, |
| 104 |
symbol-sort-fallback={name}, |
| 105 |
save-locations=false |
| 106 |
] |
| 107 |
|
| 108 |
\GlsXtrLoadResources[ |
| 109 |
src={baseunits,derivedunits}, |
| 110 |
entry-type-aliases={measurement=symbol,unit=symbol}, |
| 111 |
field-aliases={ |
| 112 |
unitname=description, |
| 113 |
unitsymbol=symbol, |
| 114 |
measurement=name |
| 115 |
}, |
| 116 |
category={measurement}, |
| 117 |
type={measurement}, |
| 118 |
set-widest, |
| 119 |
symbol-sort-fallback={name}, |
| 120 |
save-locations=false |
| 121 |
] |
| 122 |
|
| 123 |
\GlsXtrLoadResources[ |
| 124 |
src={baseunits}, |
| 125 |
entry-type-aliases={unit=symbol}, |
| 126 |
field-aliases={ |
| 127 |
unitname=description, |
| 128 |
unitsymbol=name |
| 129 |
}, |
| 130 |
category={measurement}, |
| 131 |
type={baseunit}, |
| 132 |
duplicate-label-suffix={.copy}, |
| 133 |
symbol-sort-fallback={name}, |
| 134 |
save-locations=false |
| 135 |
] |
| 136 |
|
| 137 |
\GlsXtrLoadResources[ |
| 138 |
src={miscsymbols}, |
| 139 |
field-aliases={ |
| 140 |
identifier=category, |
| 141 |
icon=name, |
| 142 |
icondescription=description |
| 143 |
}, |
| 144 |
entry-type-aliases={icon=symbol}, |
| 145 |
type={same as category}, |
| 146 |
sort-field={description}, |
| 147 |
save-locations=false, |
| 148 |
set-widest |
| 149 |
] |
| 150 |
|
| 151 |
\renewcommand*{\glsxtrlongshortdescname}{% |
| 152 |
\protect\protect\glslongfont{\the\glslongtok}\space |
| 153 |
\glsxtrparen{\glsabbrvfont{\the\glsshorttok}}% |
| 154 |
} |
| 155 |
|
| 156 |
% requires glossaries-extra v1.25: |
| 157 |
\renewcommand*{\glsxtronlyname}{% |
| 158 |
\protect\glsabbrvonlyfont{\the\glslongtok}% |
| 159 |
} |
| 160 |
|
| 161 |
\GlsXtrLoadResources[ |
| 162 |
src={miscsymbols}, |
| 163 |
selection={recorded no deps}, |
| 164 |
duplicate-label-suffix={.copy}, |
| 165 |
entry-type-aliases={icon=index}, |
| 166 |
field-aliases={ |
| 167 |
identifier=category, |
| 168 |
icondescription=symbol, |
| 169 |
icon=name |
| 170 |
}, |
| 171 |
type=index, |
| 172 |
sort-field={symbol}, |
| 173 |
group={glssymbols} |
| 174 |
] |
| 175 |
|
| 176 |
\GlsXtrLoadResources[ |
| 177 |
src={terms,bacteria,markuplanguages,vegetables,minerals, |
| 178 |
animals,chemicalformula,baseunits,derivedunits,people, |
| 179 |
films,books,miscsymbols}, |
| 180 |
selection={recorded and deps and see}, |
| 181 |
field-aliases={ |
| 182 |
identifier=category, |
| 183 |
formula=symbol, |
| 184 |
chemicalname=name, |
| 185 |
unitname=description, |
| 186 |
unitsymbol=symbol, |
| 187 |
measurement=name, |
| 188 |
icon=symbol, |
| 189 |
icondescription=name |
| 190 |
}, |
| 191 |
entry-type-aliases={ |
| 192 |
chemical=index, |
| 193 |
measurement=entry, |
| 194 |
unit=dualentry, |
| 195 |
icon=index |
| 196 |
}, |
| 197 |
label-prefix={idx.}, |
| 198 |
record-label-prefix={idx.}, |
| 199 |
type=index, |
| 200 |
dual-type=index, |
| 201 |
combine-dual-locations=both, |
| 202 |
abbreviation-sort-fallback={long}, |
| 203 |
replicate-override, |
| 204 |
replicate-fields={first=name}, |
| 205 |
identical-sort-action={category} |
| 206 |
] |
| 207 |
|
| 208 |
\newcommand*{\swaptwo}[2]{#2, #1} |
| 209 |
\newcommand*{\swapthree}[3]{#2 #3, #1} |
| 210 |
|
| 211 |
\newcommand{\bacteriafont}[1]{\emph{#1}} |
| 212 |
\glssetcategoryattribute{bacteria}{textformat}{bacteriafont} |
| 213 |
\glssetcategoryattribute{bacteria}{glossnamefont}{bacteriafont} |
| 214 |
\glssetcategoryattribute{bacteria}{glossdescfont}{bacteriafont} |
| 215 |
|
| 216 |
\newcommand{\bookfont}[1]{\emph{#1}} |
| 217 |
\glssetcategoryattribute{book}{textformat}{bookfont} |
| 218 |
\glssetcategoryattribute{book}{glossnamefont}{bookfont} |
| 219 |
|
| 220 |
\newcommand{\filmfont}[1]{\emph{#1}} |
| 221 |
\glssetcategoryattribute{film}{textformat}{filmfont} |
| 222 |
\glssetcategoryattribute{film}{glossnamefont}{filmfont} |
| 223 |
\glssetcategoryattribute{film}{glossdesc}{firstuc} |
| 224 |
|
| 225 |
\glssetcategoryattribute{markuplanguage}{glossdesc}{firstuc} |
| 226 |
|
| 227 |
\newcommand*{\glsxtrpostlinkmediacontrol}{% |
| 228 |
\glsxtrpostlinkAddDescOnFirstUse |
| 229 |
} |
| 230 |
|
| 231 |
\newcommand*{\glsxtrpostlinkinformation}{% |
| 232 |
\glsxtrpostlinkAddDescOnFirstUse |
| 233 |
} |
| 234 |
|
| 235 |
\newcommand*{\glsxtrpostlinkweather}{% |
| 236 |
\glsxtrpostlinkAddDescOnFirstUse |
| 237 |
} |
| 238 |
|
| 239 |
\newcommand*{\glsxtrpostlinkperson}{% |
| 240 |
\glsxtrifwasfirstuse |
| 241 |
{% |
| 242 |
\ifglshasfield{user3}{\glslabel}% |
| 243 |
{\space(\glscurrentfieldvalue)}% |
| 244 |
{}% |
| 245 |
}% |
| 246 |
{}% |
| 247 |
} |
| 248 |
|
| 249 |
\newcommand*{\glsxtrpostnameperson}{% |
| 250 |
\ifglshasfield{user3}{\glscurrententrylabel}% |
| 251 |
{\space(\glscurrentfieldvalue)}% |
| 252 |
{}% |
| 253 |
} |
| 254 |
|
| 255 |
\newcommand*{\glsxtrpostdescperson}{% |
| 256 |
\ifglshasfield{user1}{\glscurrententrylabel} |
| 257 |
{% born |
| 258 |
\space(\glscurrentfieldvalue\,--\,% |
| 259 |
\ifglshasfield{user2}{\glscurrententrylabel} |
| 260 |
{% died |
| 261 |
\glscurrentfieldvalue |
| 262 |
}% |
| 263 |
{}% |
| 264 |
)% |
| 265 |
}% |
| 266 |
{}% |
| 267 |
} |
| 268 |
|
| 269 |
\newcommand*{\glsxtrpostdescfilm}{% |
| 270 |
\ifglshasfield{user1}{\glscurrententrylabel}% |
| 271 |
{% |
| 272 |
\glsxtrrestorepostpunc % requires glossaries-extra v1.23+ |
| 273 |
\ (released \glscurrentfieldvalue)}% |
| 274 |
{}% |
| 275 |
\ifglshasfield{user2}{\glscurrententrylabel}% |
| 276 |
{% |
| 277 |
\glsxtrrestorepostpunc |
| 278 |
\ featuring \glscurrentfieldvalue |
| 279 |
}% |
| 280 |
{}% |
| 281 |
} |
| 282 |
|
| 283 |
\renewcommand*{\glsxtrbookindexname}[1]{% |
| 284 |
\glossentryname{#1}% |
| 285 |
\ifglshassymbol{#1}% |
| 286 |
{% |
| 287 |
\glsifcategory{#1}{chemical}% |
| 288 |
{, \glossentrysymbol{#1}}% |
| 289 |
{\space(\glossentrynameother{#1}{symbol})}% |
| 290 |
}% |
| 291 |
{% |
| 292 |
\glsifcategory{#1}{film}% |
| 293 |
{\ (film)}% |
| 294 |
{}% |
| 295 |
}% |
| 296 |
} |
| 297 |
|
| 298 |
% requires glossaries-extra v1.25+: |
| 299 |
\renewcommand*{\glsextrapostnamehook}[1]{% |
| 300 |
\glsadd[format=hyperbf]{#1}% |
| 301 |
} |
| 302 |
|
| 303 |
\newcommand{\Unit}{\glssymbol} |
| 304 |
\newcommand{\measurement}{\gls} |
| 305 |
\glsxtrnewgls{film.}{\film} |
| 306 |
\glsxtrnewglslike{idx.}{\idx}{\idxpl}{\Idx}{\Idxpl} |
| 307 |
|
| 308 |
\begin{document} |
| 309 |
\chapter{Sample} |
| 310 |
\section{Bacteria} |
| 311 |
This section is about \idxpl{bacteria}. |
| 312 |
\subsection{First Use} |
| 313 |
\gls{cbotulinum}, \gls{pputida}, \gls{cperfringens}, |
| 314 |
\gls{bsubtilis}, \gls{ctetani}, \gls{pcomposti}, |
| 315 |
\gls{pfimeticola}, \gls{cburnetii}, \gls{raustralis}, |
| 316 |
\gls{rrickettsii}. |
| 317 |
|
| 318 |
\subsection{Next Use} |
| 319 |
\gls{cbotulinum}, \gls{pputida}, \gls{cperfringens}, |
| 320 |
\gls{bsubtilis}, \gls{ctetani}, \gls{pcomposti}, |
| 321 |
\gls{pfimeticola}, \gls{cburnetii}, \gls{raustralis}, |
| 322 |
\gls{rrickettsii}. |
| 323 |
|
| 324 |
\section{Markup Languages} |
| 325 |
This section is about \idxpl{markuplanguage}. |
| 326 |
\subsection{First Use} |
| 327 |
\gls{LaTeX}, \gls{markdown}, \gls{xhtml}, \gls{mathml}, \gls{svg}. |
| 328 |
|
| 329 |
\subsection{Next Use} |
| 330 |
\gls{LaTeX}, \gls{markdown}, \gls{xhtml}, \gls{mathml}, \gls{svg}. |
| 331 |
|
| 332 |
\section{Vegetables} |
| 333 |
This section is about \idxpl{vegetable}. |
| 334 |
\Gls{cabbage}, \gls{brussels-sprout}, \gls{artichoke}, |
| 335 |
\gls{cauliflower}, \gls{courgette}, \gls{spinach}. |
| 336 |
|
| 337 |
\section{Minerals} |
| 338 |
This section is about \idxpl{mineral}. |
| 339 |
\Gls{beryl}, \gls{amethyst}, \gls{chalcedony}, \gls{aquamarine}, |
| 340 |
\gls{aragonite}, \gls{calcite}, \gls{bilinite}, |
| 341 |
\gls{cyanotrichite}, \gls{biotite}, \gls{dolomite}, |
| 342 |
\gls{quetzalcoatlite}, \gls{vulcanite}. |
| 343 |
|
| 344 |
\section{Animals} |
| 345 |
This section is about \idxpl{animal}. |
| 346 |
\Gls{duck}, \gls{parrot}, \gls{hedgehog}, \gls{sealion}, |
| 347 |
\gls{zander}, \gls{aardvark}, \gls{zebra}, \gls{swan}, |
| 348 |
\gls{armadillo}. |
| 349 |
|
| 350 |
\section{Chemicals} |
| 351 |
This section is about \idxpl{chemical}. |
| 352 |
\gls{Al2SO43} (\glsdesc{Al2SO43}), \gls{H2O} (\glsdesc{H2O}), |
| 353 |
\gls{C6H12O6} (\glsdesc{C6H12O6}), \gls{CH3CH2OH} |
| 354 |
(\glsdesc{CH3CH2OH}), \gls{CH2O} (\glsdesc{CH2O}), \gls{OF2} |
| 355 |
(\glsdesc{OF2}), \gls{O2F2} (\glsdesc{O2F2}), \gls{SO42-} |
| 356 |
(\glsdesc{SO42-}), \gls{H3O+} (\glsdesc{H3O+}), \gls{OH-} |
| 357 |
(\glsdesc{OH-}), \gls{O2} (\glsdesc{O2}), \gls{AlF3} |
| 358 |
(\glsdesc{AlF3}), \gls{O} (\glsdesc{O}), \gls{Al2CoO4} |
| 359 |
(\glsdesc{Al2CoO4}), \gls{As4S4} (\glsdesc{As4S4}), |
| 360 |
\gls{C10H10O4} (\glsdesc{C10H10O4}), \gls{C5H4NCOOH} |
| 361 |
(\glsdesc{C5H4NCOOH}), \gls{C8H10N4O2} (\gls{C8H10N4O2}), |
| 362 |
\gls{SO2} (\glsdesc{SO2}), \gls{S2O72-} (\gls{S2O72-}), |
| 363 |
\gls{SbBr3} (\glsdesc{SbBr3}), \gls{Sc2O3} (\glsdesc{Sc2O3}), |
| 364 |
\gls{Zr3PO44} (\glsdesc{Zr3PO44}), \gls{ZnF2} (\glsdesc{ZnF2}). |
| 365 |
|
| 366 |
\section{SI Units} |
| 367 |
\Idxpl{baseunit}: \Unit{ampere} (measures \measurement{ampere}), |
| 368 |
\Unit{kilogram} (measures \measurement{kilogram}), \Unit{metre}, |
| 369 |
\Unit{second}, \Unit{kelvin}, \Unit{mole}, \Unit{candela}. |
| 370 |
|
| 371 |
\Idxpl{derivedunit}: \Unit{area}, \Unit{volume}, |
| 372 |
\Unit{velocity}, |
| 373 |
\Unit{acceleration}, \Unit{density}, \Unit{luminance}, |
| 374 |
\Unit{specificvolume}, \Unit{concentration}, \Unit{wavenumber}. |
| 375 |
|
| 376 |
\section{Books and Films} |
| 377 |
\Idxpl{book}: \gls{ataleoftwocities} (by \gls{dickens}), |
| 378 |
\gls{thebigsleep} (by \gls{chandler}, \idx{film} adaptation: |
| 379 |
\film{thebigsleep}), \gls{icecoldinalex} (by |
| 380 |
\gls{landon}, \idx{film} adaptation: \film{icecoldinalex}), |
| 381 |
\gls{whydidnttheyaskevans} (by \gls{christie}, |
| 382 |
\idx{film} adaptation: \film{whydidnttheyaskevans}), |
| 383 |
\gls{doandroidsdreamofelectricsheep} (by \gls{dick}, |
| 384 |
inspired the \idx{film} \film{bladerunner}). |
| 385 |
|
| 386 |
\Idxpl{film}: \film{anunexpectedjourney}, \film{desolationofsmaug} |
| 387 |
and \film{thebattleoffivearmies} (adapted from the |
| 388 |
\idx{book} \gls{thehobbit} by \gls{tolkien}), |
| 389 |
\film{thefellowshipofthering}, \film{thetwotowers} |
| 390 |
and \film{thereturnoftheking} (adapted from the |
| 391 |
\idx{book} \gls{thelordoftherings} also by \gls{tolkien}). |
| 392 |
|
| 393 |
\section{Miscellaneous Symbols} |
| 394 |
|
| 395 |
\subsection{First Use} |
| 396 |
|
| 397 |
\Idxpl{mediacontrol}: \gls{forward}, \gls{forwardtoindex}, |
| 398 |
\gls{rewindtoindex}, \gls{rewind}. |
| 399 |
|
| 400 |
\Idx{information}: \gls{bicycle}, \gls{coffeecup}, \gls{info}, |
| 401 |
\gls{gentsroom}, \gls{ladiesroom}, \gls{wheelchair}, \gls{football}, |
| 402 |
\gls{recycling}. |
| 403 |
|
| 404 |
\Idx{weather}: \gls{cloud}, \gls{fog}, \gls{hail}, \gls{sun}, |
| 405 |
\gls{lightning}. |
| 406 |
|
| 407 |
\subsection{Next Use} |
| 408 |
|
| 409 |
\Idxpl{mediacontrol}: \gls{forward}, \gls{forwardtoindex}, |
| 410 |
\gls{rewindtoindex}, \gls{rewind}. |
| 411 |
|
| 412 |
\Idx{information}: \gls{bicycle}, \gls{coffeecup}, \gls{info}, |
| 413 |
\gls{gentsroom}, \gls{ladiesroom}, \gls{wheelchair}, \gls{football}. |
| 414 |
|
| 415 |
\Idx{weather}: \gls{cloud}, \gls{fog}, \gls{hail}, \gls{sun}, |
| 416 |
\gls{lightning}. |
| 417 |
|
| 418 |
\section{Measurements} |
| 419 |
|
| 420 |
\Idxpl{measurement}: |
| 421 |
\measurement{ampere}, \measurement{area}, \measurement{metre}. |
| 422 |
|
| 423 |
\chapter{Glossaries} |
| 424 |
\printunsrtglossary[type=bacteria,style=mcoltree] |
| 425 |
\printunsrtglossary[type=markuplanguage,style=altlist] |
| 426 |
\printunsrtglossary[type=vegetable,style=tree,nogroupskip] |
| 427 |
\printunsrtglossary[type=mineral,style=treegroup] |
| 428 |
\printunsrtglossary[type=animal,style=tree] |
| 429 |
\printunsrtglossary[type=person,style=tree,nogroupskip] |
| 430 |
\printunsrtglossary[type=book,style=tree,nogroupskip] |
| 431 |
\printunsrtglossary[type=film,style=tree,nogroupskip] |
| 432 |
\printunsrtglossary*[type=chemical,style=mcolalttreegroup] |
| 433 |
{% |
| 434 |
\renewcommand*{\glstreenamefmt}[1]{#1}% |
| 435 |
\renewcommand*{\glstreegroupheaderfmt}[1]{\textbf{#1}}% |
| 436 |
} |
| 437 |
\printunsrtglossary*[type=measurement,style=alttree,nogroupskip] |
| 438 |
{% |
| 439 |
\renewcommand{\glsxtralttreeSymbolDescLocation}[2]{% |
| 440 |
\glossentrydesc{#1}% |
| 441 |
\ifglshassymbol{#1}{\space(\glossentrysymbol{#1})}{}% |
| 442 |
\glspostdescription |
| 443 |
\glsxtrAltTreePar |
| 444 |
}% |
| 445 |
} |
| 446 |
|
| 447 |
\printunsrtglossary*[type=baseunit,style=alttree,nogroupskip] |
| 448 |
{% |
| 449 |
\glsFindWidestTopLevelName[baseunit]% |
| 450 |
} |
| 451 |
\printunsrtglossary[type=information,style=alttree,nogroupskip] |
| 452 |
\printunsrtglossary[type=mediacontrol,style=alttree,nogroupskip] |
| 453 |
\printunsrtglossary[type=weather,style=alttree,nogroupskip] |
| 454 |
|
| 455 |
\printunsrtglossary*[type=index,style=bookindex] |
| 456 |
{% |
| 457 |
\setupglossaries{section=chapter}% |
| 458 |
\let\sortname\swaptwo |
| 459 |
\let\sortvonname\swapthree |
| 460 |
\renewcommand*{\glsextrapostnamehook}[1]{}% |
| 461 |
} |
| 462 |
\end{document}} |