diff options
author | Karl Berry <karl@freefriends.org> | 2017-11-26 23:27:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-11-26 23:27:56 +0000 |
commit | 2405725149721117da17b64f42ef5d9759583cf3 (patch) | |
tree | e227d85b9aaf1a3dfd339d3ee47f5c75bdee95e9 /Master/texmf-dist/doc/support/bib2gls/examples/sample-units3.tex | |
parent | 62ff83822fbd8add0ad826135f17f8ba7004bf34 (diff) |
bib2gls (26nov17)
git-svn-id: svn://tug.org/texlive/trunk@45917 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/support/bib2gls/examples/sample-units3.tex')
-rw-r--r-- | Master/texmf-dist/doc/support/bib2gls/examples/sample-units3.tex | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/support/bib2gls/examples/sample-units3.tex b/Master/texmf-dist/doc/support/bib2gls/examples/sample-units3.tex new file mode 100644 index 00000000000..997a1ff47ca --- /dev/null +++ b/Master/texmf-dist/doc/support/bib2gls/examples/sample-units3.tex @@ -0,0 +1,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} |