Debian Codegraph @

texmf-dist/doc/support/bib2gls/examples/sample-media.tex

raw
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[11pt,a4paper]{report}
6
7 \usepackage[T1]{fontenc}
8 \usepackage[colorlinks]{hyperref}
9 \usepackage[record,% using bib2gls
10 nostyles,% don't load default styles
11 postdot,% append a dot after descriptions
12 stylemods={list},% load glossary-list.sty and fix styles
13 style=altlistgroup]{glossaries-extra}
14
15 \GlsXtrLoadResources[
16 src=no-interpret-preamble,
17 interpret-preamble=false
18 ]
19
20 \GlsXtrLoadResources[
21 src={interpret-preamble,books,films},
22 field-aliases={identifier=category,year=user1,cast=user2},
23 bibtex-contributor-fields={user2},
24 contributor-order={forenames},
25 identical-sort-action={category},
26 save-locations=false,
27 selection=all
28 ]
29
30 % requires datatool-base.sty v2.28+:
31 \renewcommand*{\DTLlistformatoxford}{,}
32 \renewcommand*{\DTLandname}{and}
33
34 \newcommand*{\bookfont}[1]{\emph{#1}}
35 \newcommand*{\filmfont}[1]{\textsf{\em #1}}
36
37 \glssetcategoryattribute{book}{textformat}{bookfont}
38 \glssetcategoryattribute{book}{glossnamefont}{bookfont}
39
40 \glssetcategoryattribute{film}{textformat}{filmfont}
41 \glssetcategoryattribute{film}{glossnamefont}{filmfont}
42
43 \newcommand*{\glsxtrpostnamebook}{%
44 \ifglshasfield{user1}{\glscurrententrylabel}%
45 {\space(published \glscurrentfieldvalue)}%
46 {}%
47 }
48
49 \newcommand*{\glsxtrpostnamefilm}{%
50 \ifglshasfield{user1}{\glscurrententrylabel}%
51 {\space (released \glscurrentfieldvalue)}%
52 {}%
53 }
54
55 \newcommand*{\glsxtrpostdescfilm}{%
56 \ifglshasfield{user2}{\glscurrententrylabel}%
57 {%
58 \glsxtrrestorepostpunc % requires glossaries-extra v1.23+
59 \ featuring \glscurrentfieldvalue
60 }%
61 {}%
62 }
63
64 \begin{document}
65 \printunsrtglossaries
66 \end{document}