| 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[colorlinks]{hyperref} |
| 12 |
|
| 13 |
\usepackage[record,% use bib2gls |
| 14 |
section,% use \section* for glossary headings |
| 15 |
postdot,% insert dot after descriptions in glossaries |
| 16 |
nomain,% don't create 'main' glossary |
| 17 |
index,% create 'index' glossary |
| 18 |
nostyles,% don't load default styles |
| 19 |
% load and patch required style packages: |
| 20 |
stylemods={list,mcols,tree,bookindex} |
| 21 |
]{glossaries-extra} |
| 22 |
|
| 23 |
\newglossary*{bacteria}{Bacteria} |
| 24 |
\newglossary*{markuplanguage}{Markup Languages} |
| 25 |
\newglossary*{vegetable}{Vegetables} |
| 26 |
\newglossary*{mineral}{Minerals} |
| 27 |
\newglossary*{animal}{Animals} |
| 28 |
\newglossary*{chemical}{Chemical Formula} |
| 29 |
\newglossary*{baseunit}{SI Units} |
| 30 |
\newglossary*{derivedunit}{Derived Units} |
| 31 |
|
| 32 |
% abbreviation styles must be set before \GlsXtrLoadResources: |
| 33 |
\setabbreviationstyle[bacteria]{long-only-short-only} |
| 34 |
\setabbreviationstyle[markuplanguage]{long-short-desc} |
| 35 |
|
| 36 |
% style-dependent name format must be set |
| 37 |
% before \GlsXtrLoadResources: |
| 38 |
\renewcommand*{\glsxtrlongshortdescname}{% |
| 39 |
\protect\glsabbrvfont{\the\glsshorttok}\space |
| 40 |
\glsxtrparen{\glslongfont{\the\glslongtok}}% |
| 41 |
} |
| 42 |
|
| 43 |
\GlsXtrLoadResources[ |
| 44 |
src={bacteria,markuplanguages,vegetables,minerals, |
| 45 |
animals,chemicalformula,baseunits,derivedunits}, |
| 46 |
selection={recorded and deps and see}, |
| 47 |
set-widest, |
| 48 |
type=index, |
| 49 |
label-prefix={idx.}, |
| 50 |
dual-prefix={}, |
| 51 |
cs-label-prefix={}, |
| 52 |
combine-dual-locations={primary}, |
| 53 |
dual-field, |
| 54 |
sort={en}, |
| 55 |
sort-field={name}, |
| 56 |
dual-type={same as category}, |
| 57 |
dual-sort={en}, |
| 58 |
dual-sort-number-pad={2}, |
| 59 |
dual-sort-pad-plus={1}, |
| 60 |
dual-sort-pad-minus={0}, |
| 61 |
dual-break-at=upper-upper-word, |
| 62 |
entry-type-aliases={ |
| 63 |
abbreviation=dualindexabbreviation, |
| 64 |
entry=dualindexentry, |
| 65 |
symbol=dualindexsymbol, |
| 66 |
unit=dualindexsymbol, |
| 67 |
measurement=dualindexsymbol, |
| 68 |
chemical=dualindexsymbol |
| 69 |
}, |
| 70 |
abbreviation-name-fallback={long}, |
| 71 |
symbol-sort-fallback={name}, |
| 72 |
field-aliases={ |
| 73 |
identifier=category, |
| 74 |
formula=symbol, |
| 75 |
chemicalname=name, |
| 76 |
unitname=name, |
| 77 |
unitsymbol=symbol, |
| 78 |
measurement=description |
| 79 |
}, |
| 80 |
] |
| 81 |
|
| 82 |
\newcommand{\bacteriafont}[1]{\emph{#1}} |
| 83 |
\glssetcategoryattribute{bacteria}{textformat}{bacteriafont} |
| 84 |
\glssetcategoryattribute{bacteria}{glossnamefont}{bacteriafont} |
| 85 |
\glssetcategoryattribute{bacteria}{glossdescfont}{bacteriafont} |
| 86 |
|
| 87 |
\glssetcategoryattribute{markuplanguage}{glossdesc}{firstuc} |
| 88 |
|
| 89 |
\renewcommand*{\glsxtrbookindexname}[1]{% |
| 90 |
\glossentryname{#1}% |
| 91 |
\ifglshassymbol{#1}% |
| 92 |
{% |
| 93 |
\glsifcategory{#1}{chemical}% |
| 94 |
{, \glossentrysymbol{#1}}% |
| 95 |
{\space(\glossentrynameother{#1}{symbol})}% |
| 96 |
}% |
| 97 |
{% |
| 98 |
\glsifcategory{#1}{markuplanguage}% |
| 99 |
{% |
| 100 |
\glsxtrifhasfield{short}{\glsxtrusefield{#1}{dual}}% |
| 101 |
{\space(\glscurrentfieldvalue)}% |
| 102 |
{}% |
| 103 |
}% |
| 104 |
{}% |
| 105 |
}% |
| 106 |
} |
| 107 |
|
| 108 |
\begin{document} |
| 109 |
\chapter{Sample} |
| 110 |
\section{Bacteria} |
| 111 |
\subsection{First Use} |
| 112 |
\gls{cbotulinum}, \gls{pputida}, \gls{cperfringens}, |
| 113 |
\gls{bsubtilis}, \gls{ctetani}, \gls{pcomposti}, |
| 114 |
\gls{pfimeticola}, \gls{cburnetii}, \gls{raustralis}, |
| 115 |
\gls{rrickettsii}. |
| 116 |
|
| 117 |
\subsection{Next Use} |
| 118 |
\gls{cbotulinum}, \gls{pputida}, \gls{cperfringens}, |
| 119 |
\gls{bsubtilis}, \gls{ctetani}, \gls{pcomposti}, |
| 120 |
\gls{pfimeticola}, \gls{cburnetii}, \gls{raustralis}, |
| 121 |
\gls{rrickettsii}. |
| 122 |
|
| 123 |
\section{Markup Languages} |
| 124 |
\subsection{First Use} |
| 125 |
\gls{LaTeX}, \gls{markdown}, \gls{xhtml}, \gls{mathml}, \gls{svg}. |
| 126 |
|
| 127 |
\subsection{Next Use} |
| 128 |
\gls{LaTeX}, \gls{markdown}, \gls{xhtml}, \gls{mathml}, \gls{svg}. |
| 129 |
|
| 130 |
\section{Vegetables} |
| 131 |
\gls{cabbage}, \gls{brussels-sprout}, \gls{artichoke}, |
| 132 |
\gls{cauliflower}, \gls{courgette}, \gls{spinach}. |
| 133 |
|
| 134 |
\section{Minerals} |
| 135 |
\Gls{beryl}, \gls{amethyst}, \gls{chalcedony}, \gls{aquamarine}, |
| 136 |
\gls{aragonite}, \gls{calcite}, \gls{bilinite}, |
| 137 |
\gls{cyanotrichite}, \gls{biotite}, \gls{dolomite}, |
| 138 |
\gls{quetzalcoatlite}, \gls{vulcanite}. |
| 139 |
|
| 140 |
\section{Animals} |
| 141 |
\Gls{duck}, \gls{parrot}, \gls{hedgehog}, \gls{sealion}. |
| 142 |
|
| 143 |
\section{Chemicals} |
| 144 |
\gls{Al2SO43}, \gls{H2O}, \gls{C6H12O6}, |
| 145 |
\gls{CH3CH2OH}, \gls{CH2O}, \gls{OF2}, \gls{O2F2}, \gls{SO42-}, |
| 146 |
\gls{H3O+}, \gls{OH-}, \gls{O2}, \gls{AlF3}, \gls{O}, |
| 147 |
\gls{Al2CoO4}, \gls{As4S4}, \gls{C10H10O4}, \gls{C5H4NCOOH}, |
| 148 |
\gls{C8H10N4O2}, \gls{SO2}, \gls{S2O72-}, \gls{SbBr3}, |
| 149 |
\gls{Sc2O3}, \gls{Zr3PO44}, \gls{ZnF2}. |
| 150 |
|
| 151 |
\section{SI Units} |
| 152 |
Base: \gls{ampere}, \gls{kilogram}, \gls{metre}, \gls{second}, |
| 153 |
\gls{kelvin}, \gls{mole}, \gls{candela}. |
| 154 |
Derived: \gls{area}, \gls{volume}, \gls{velocity}, |
| 155 |
\gls{acceleration}, \gls{density}, \gls{luminance}, |
| 156 |
\gls{specificvolume}, \gls{concentration}, \gls{wavenumber}. |
| 157 |
|
| 158 |
\chapter*{Glossaries} |
| 159 |
\renewcommand{\glsextrapostnamehook}[1]{\glsadd[format=hyperbf]{#1}} |
| 160 |
\printunsrtglossary[type=bacteria,style=mcoltree] |
| 161 |
\printunsrtglossary[type=markuplanguage,style=altlist] |
| 162 |
\printunsrtglossary[type=vegetable,style=tree,nogroupskip] |
| 163 |
\printunsrtglossary[type=mineral,style=treegroup] |
| 164 |
\printunsrtglossary[type=animal,style=tree] |
| 165 |
\printunsrtglossary*[type=chemical,style=mcolalttreegroup] |
| 166 |
{% |
| 167 |
\renewcommand\glsxtralttreeSymbolDescLocation[2]{% |
| 168 |
\glossentrysymbol{#1}\glspostdescription\glsxtrAltTreePar |
| 169 |
}% |
| 170 |
\renewcommand*{\glstreenamefmt}[1]{#1}% |
| 171 |
\renewcommand*{\glstreegroupheaderfmt}[1]{\textbf{#1}}% |
| 172 |
} |
| 173 |
\printunsrtglossary[type=baseunit,style=alttree] |
| 174 |
\printunsrtglossary[type=derivedunit,style=alttree] |
| 175 |
|
| 176 |
\renewcommand{\glsextrapostnamehook}[1]{} |
| 177 |
\setupglossaries{section=chapter} |
| 178 |
\printunsrtglossary[type=index,style=bookindex] |
| 179 |
\end{document}} |