| 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[12pt,a4paper]{report} |
| 6 |
|
| 7 |
\usepackage[colorlinks]{hyperref} |
| 8 |
\usepackage[record,% using bib2gls |
| 9 |
index,% create index glossary |
| 10 |
postdot,% dot after descriptions |
| 11 |
% load glossary-list.sty and glossary-bookindex.sty and patch: |
| 12 |
stylemods={list,bookindex}, |
| 13 |
style=altlistgroup]{glossaries-extra} |
| 14 |
|
| 15 |
\newglossary*{bybirth}{People (Ordered by Birth)} |
| 16 |
|
| 17 |
\newcommand{\bibglsdategroup}[7]{#1#4#7} |
| 18 |
\newcommand{\bibglsdategrouptitle}[7]{\number#1\ #4} |
| 19 |
|
| 20 |
\newcommand*{\swaptwo}[2]{#2, #1} |
| 21 |
\newcommand*{\swapthree}[3]{#2 #3, #1} |
| 22 |
|
| 23 |
\BibGlsOptions{break-space} |
| 24 |
|
| 25 |
\GlsXtrLoadResources[ |
| 26 |
src=no-interpret-preamble, |
| 27 |
interpret-preamble=false |
| 28 |
] |
| 29 |
|
| 30 |
\GlsXtrLoadResources[ |
| 31 |
src={interpret-preamble,people}, |
| 32 |
match={entrytype=entry}, |
| 33 |
category={people}, |
| 34 |
replicate-fields={name={first}}, |
| 35 |
field-aliases={born=user1,died=user2,othername=user3}, |
| 36 |
secondary={date:user1:bybirth}, |
| 37 |
secondary-date-sort-format={d MMM YYYY G} |
| 38 |
] |
| 39 |
|
| 40 |
\GlsXtrLoadResources[ |
| 41 |
src={people}, |
| 42 |
type=index, |
| 43 |
category=people, |
| 44 |
action={define or copy}, |
| 45 |
copy-action-group-field={indexgroup}, |
| 46 |
selection={recorded and deps and see} |
| 47 |
] |
| 48 |
|
| 49 |
\newcommand*{\glsxtrpostlinkpeople}{% |
| 50 |
\glsxtrifwasfirstuse |
| 51 |
{% |
| 52 |
\ifglshasfield{user3}{\glslabel}% |
| 53 |
{\space(\glscurrentfieldvalue)}% |
| 54 |
{}% |
| 55 |
}% |
| 56 |
{}% |
| 57 |
} |
| 58 |
|
| 59 |
\newcommand*{\glsxtrpostnamepeople}{% |
| 60 |
\ifglshasfield{user3}{\glscurrententrylabel}% |
| 61 |
{\space(\glscurrentfieldvalue)}% |
| 62 |
{}% |
| 63 |
} |
| 64 |
|
| 65 |
\newcommand*{\glsxtrpostdescpeople}{% |
| 66 |
\ifglshasfield{user1}{\glscurrententrylabel} |
| 67 |
{% born |
| 68 |
\space(\glscurrentfieldvalue\,--\,% |
| 69 |
\ifglshasfield{user2}{\glscurrententrylabel} |
| 70 |
{% died |
| 71 |
\glscurrentfieldvalue |
| 72 |
}% |
| 73 |
{}% |
| 74 |
)% |
| 75 |
}% |
| 76 |
{}% |
| 77 |
} |
| 78 |
|
| 79 |
\begin{document} |
| 80 |
\chapter{Sample} |
| 81 |
\section{First Use} |
| 82 |
|
| 83 |
\gls{caesar}, \gls{wellesley}, \gls{bonaparte}, |
| 84 |
\gls{vonrichthofen} and \gls{alexander}. |
| 85 |
|
| 86 |
\section{Next Use} |
| 87 |
|
| 88 |
\gls{caesar}, \gls{wellesley}, \gls{bonaparte}, |
| 89 |
\gls{vonrichthofen} and \gls{alexander}. |
| 90 |
|
| 91 |
\printunsrtglossary[title={People (Alphabetical)},nonumberlist] |
| 92 |
|
| 93 |
\printunsrtglossary[type=bybirth,target=false,nonumberlist] |
| 94 |
|
| 95 |
\printunsrtglossary* |
| 96 |
[type=index,style=bookindex] |
| 97 |
{% |
| 98 |
\let\sortname\swaptwo |
| 99 |
\let\sortart\swaptwo |
| 100 |
\let\sortvonname\swapthree |
| 101 |
\renewcommand{\glsxtrgroupfield}{indexgroup}% |
| 102 |
\renewcommand*{\glolinkprefix}{idx:}% |
| 103 |
} |
| 104 |
\end{document} |