summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/glossaries-extra/sample-indexhook.tex
blob: 459888c0b4ca1ce9ae994631b66f7a09a56cd0d7 (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
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
\documentclass{article}

\usepackage{etoolbox}
\usepackage
 [
  indexcrossrefs=false% cross-ref indexing performed explicitly
 ]
 {glossaries-extra}

\makeglossaries

% Keep a list of entries that have been indexed
\newcommand*{\indexedlist}{}
\renewcommand*{\glsxtrdowrglossaryhook}[1]{%
  \xifinlist{#1}{\indexedlist}{}{\listxadd{\indexedlist}{#1}}%
}

\newglossaryentry{sample1}{name={sample 1},description={an example}}
\newglossaryentry{sample2}{name={sample 2},description={an
example},see={sample1}}
\newglossaryentry{sample3}{name={sample 3},description={an
example},see={sample2}}

\newglossaryentry{sample4}{name={sample 4},description={an example}}

\begin{document}
This is sample document.

\gls{sample3}.

\printglossaries

% index all the cross-referenced entries that haven't been used:
\glsxtraddallcrossrefs

Entries that haven't been indexed:
\forglsentries{\thislabel}{\xifinlist{\thislabel}{\indexedlist}{}{\space\thislabel}}.

\end{document}