| 1 |
% This file is embedded in glossaries-extra-manual.pdf |
| 2 |
% Example 146 Sub-glossary for a given counter value ordered by use in the section |
| 3 |
% Label: "ex:minigloss2" |
| 4 |
% arara: pdflatex |
| 5 |
% arara: bib2gls |
| 6 |
% arara: pdflatex |
| 7 |
% arara: pdfcrop |
| 8 |
\documentclass[12pt]{article} |
| 9 |
\pagestyle{empty} |
| 10 |
\begin{filecontents*}{\jobname.bib} |
| 11 |
@symbol{pi,name={\ensuremath{\pi}}, |
| 12 |
description={ratio of the length of the circumference of a circle to its diameter}} |
| 13 |
@symbol{root2,name={\ensuremath{\surd2}}, |
| 14 |
description={Pythagoras' constant}} |
| 15 |
@symbol{zeta3,name={\ensuremath{\zeta(3)}}, |
| 16 |
description={Ap\'ery's constant}} |
| 17 |
@symbol{zero,name={0}, |
| 18 |
description={nothing or nil}} |
| 19 |
@symbol{one,name={1}, |
| 20 |
description={single entity, unity}} |
| 21 |
\end{filecontents*} |
| 22 |
\usepackage[record,stylemods,style=index]{glossaries-extra} |
| 23 |
\GlsXtrRecordCounter{section} |
| 24 |
\GlsXtrLoadResources[src={\jobname}, |
| 25 |
symbol-sort-fallback=description |
| 26 |
] |
| 27 |
|
| 28 |
\renewcommand{\glsxtrAddCounterRecordHook}[3]{% |
| 29 |
\provideignoredglossary{#2.#3}% |
| 30 |
\glsxtrcopytoglossary*{#1}{#2.#3}% |
| 31 |
} |
| 32 |
|
| 33 |
\newcommand{\minigloss}{% |
| 34 |
\printunsrtglossary*[type=section.\thesection, |
| 35 |
target=false] |
| 36 |
{\renewcommand*{\glossarysection}[2][]{}} |
| 37 |
\printunsrtglossaryunitpostskip |
| 38 |
} |
| 39 |
\begin{document} |
| 40 |
\section{Sample} |
| 41 |
\minigloss |
| 42 |
This section discusses \gls{pi}, \gls{root2} and \gls{zeta3}. |
| 43 |
|
| 44 |
\section{Another Sample} |
| 45 |
\minigloss |
| 46 |
This section discusses \gls{one}, \gls{pi} and \gls{zero}. |
| 47 |
|
| 48 |
\printunsrtglossaries |
| 49 |
\end{document} |