summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/glossaries-extra/glossaries-extra-manual-examples/glossaries-extra-manual-example145.tex
blob: 2c333acae45d71bbcdc4f31c512736dd23c54328 (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
% This file is embedded in glossaries-extra-manual.pdf
% Example 145 Sub-glossary for a given counter value ordered by use in the section
% Label: "ex:minigloss2"
% arara: pdflatex
% arara: bib2gls
% arara: pdflatex
% arara: pdfcrop
\documentclass[12pt]{article}
\pagestyle{empty}
\begin{filecontents*}{\jobname.bib}
@symbol{pi,name={\ensuremath{\pi}},
description={ratio of the length of the circumference of a circle to its diameter}}
@symbol{root2,name={\ensuremath{\surd2}},
description={Pythagoras' constant}}
@symbol{zeta3,name={\ensuremath{\zeta(3)}},
description={Ap\'ery's constant}}
@symbol{zero,name={0},
description={nothing or nil}}
@symbol{one,name={1},
description={single entity, unity}} 
\end{filecontents*}
\usepackage[record,stylemods,style=index]{glossaries-extra}
 \GlsXtrRecordCounter{section}
 \GlsXtrLoadResources[src={\jobname},
 symbol-sort-fallback=description
] 

\renewcommand{\glsxtrAddCounterRecordHook}[3]{%
 \provideignoredglossary{#2.#3}%
 \glsxtrcopytoglossary*{#1}{#2.#3}%
} 

\newcommand{\minigloss}{%
 \printunsrtglossary*[type=section.\thesection,
 target=false]
 {\renewcommand*{\glossarysection}[2][]{}}
 \printunsrtglossaryunitpostskip
} 
\begin{document}
\section{Sample}
\minigloss
This section discusses \gls{pi}, \gls{root2} and \gls{zeta3}. 

\section{Another Sample}
\minigloss
This section discusses \gls{one}, \gls{pi} and \gls{zero}. 

\printunsrtglossaries 
\end{document}