summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/support/bib2gls/examples/sample-media.tex
blob: b04b93241bb1ed47d6df54082345491d67157957 (plain)
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
66
% This file is public domain. See the "Examples" chapter
% in the bib2gls user manual for a more detailed description
% of this file.

\documentclass[11pt,a4paper]{report}

\usepackage[T1]{fontenc}
\usepackage[colorlinks]{hyperref}
\usepackage[record,% using bib2gls
 nostyles,% don't load default styles
 postdot,% append a dot after descriptions
 stylemods={list},% load glossary-list.sty and fix styles
 style=altlistgroup]{glossaries-extra}

\GlsXtrLoadResources[
  src=no-interpret-preamble,
  interpret-preamble=false
]

\GlsXtrLoadResources[
  src={interpret-preamble,books,films},
  field-aliases={identifier=category,year=user1,cast=user2},
  bibtex-contributor-fields={user2},
  contributor-order={forenames},
  identical-sort-action={category},
  save-locations=false,
  selection=all
]

% requires datatool-base.sty v2.28+:
\renewcommand*{\DTLlistformatoxford}{,}
\renewcommand*{\DTLandname}{and}

\newcommand*{\bookfont}[1]{\emph{#1}}
\newcommand*{\filmfont}[1]{\textsf{\em #1}}

\glssetcategoryattribute{book}{textformat}{bookfont}
\glssetcategoryattribute{book}{glossnamefont}{bookfont}

\glssetcategoryattribute{film}{textformat}{filmfont}
\glssetcategoryattribute{film}{glossnamefont}{filmfont}

\newcommand*{\glsxtrpostnamebook}{%
 \ifglshasfield{user1}{\glscurrententrylabel}%
 {\space(published \glscurrentfieldvalue)}%
 {}%
}

\newcommand*{\glsxtrpostnamefilm}{%
 \ifglshasfield{user1}{\glscurrententrylabel}%
 {\space (released \glscurrentfieldvalue)}%
 {}%
}

\newcommand*{\glsxtrpostdescfilm}{%
 \ifglshasfield{user2}{\glscurrententrylabel}%
 {%
   \glsxtrrestorepostpunc % requires glossaries-extra v1.23+
   \ featuring \glscurrentfieldvalue
 }%
 {}%
}

\begin{document}
\printunsrtglossaries
\end{document}