| 1 |
% This file is embedded in glossaries-extra-manual.pdf |
| 2 |
% Example 140 Displaying unsorted glossaries with custom groups and sub-group headings |
| 3 |
% Label: "ex:unsrtcustomsubgrp" |
| 4 |
% arara: pdflatex |
| 5 |
% arara: pdfcrop |
| 6 |
\documentclass[12pt]{article} |
| 7 |
\pagestyle{empty} |
| 8 |
\usepackage[record,stylemods=bookindex,style=bookindex]{glossaries-extra} |
| 9 |
|
| 10 |
|
| 11 |
\glsxtrsetgrouptitle{group1label}{Group 1} |
| 12 |
\glsxtrsetgrouptitle{group2label}{Group 2} |
| 13 |
\glsxtrsetgrouptitle{group3label}{Group 3} |
| 14 |
\glsxtrsetgrouptitle{group4label}{Group 4} |
| 15 |
|
| 16 |
|
| 17 |
\newglossaryentry{waterfowl}{name={waterfowl}, |
| 18 |
description={}, |
| 19 |
group={group1label}} |
| 20 |
\newglossaryentry{ant}{name={ant}, |
| 21 |
description={}, |
| 22 |
group={group1label}} |
| 23 |
\GlsXtrSetField{ant}{secondarygroup}{group4label} |
| 24 |
\newglossaryentry{adder}{name={adder}, |
| 25 |
description={}, |
| 26 |
group={group2label}} |
| 27 |
\newglossaryentry{duck}{name={duck}, |
| 28 |
parent={waterfowl}, |
| 29 |
description={},group={group4label}} |
| 30 |
\GlsXtrSetField{duck}{secondarygroup}{group2label} |
| 31 |
\newglossaryentry{zebra}{name={zebra}, |
| 32 |
description={}, |
| 33 |
group={group2label}} |
| 34 |
\GlsXtrSetField{zebra}{secondarygroup}{group3label} |
| 35 |
\newglossaryentry{aardvark}{name={aardvark}, |
| 36 |
description={}, |
| 37 |
group={group2label}} |
| 38 |
\GlsXtrSetField{aardvark}{secondarygroup}{group1label} |
| 39 |
\newglossaryentry{gazelle}{name={gazelle}, |
| 40 |
description={}, |
| 41 |
group={group1label}} |
| 42 |
\newglossaryentry{mallard}{name={mallard}, |
| 43 |
parent={duck},description={}, |
| 44 |
group={group2label}} |
| 45 |
\GlsXtrSetField{mallard}{secondarygroup}{group3label} |
| 46 |
|
| 47 |
|
| 48 |
\newglossary*{another}{Another Glossary} |
| 49 |
\glsxtrcopytoglossary{mallard}{another} |
| 50 |
\glsxtrcopytoglossary{aardvark}{another} |
| 51 |
\glsxtrcopytoglossary{zebra}{another} |
| 52 |
\glsxtrcopytoglossary{ant}{another} |
| 53 |
\glsxtrcopytoglossary{duck}{another} |
| 54 |
\setglossarypreamble[another] |
| 55 |
{\renewcommand{\glsxtrgroupfield}{secondarygroup}} |
| 56 |
\begin{document} |
| 57 |
\renewcommand*{\glsxtraddgroup}[2]{#2} |
| 58 |
\printunsrtglossary |
| 59 |
\renewcommand*{\glsxtraddgroup}[2]{% |
| 60 |
\ifnum\glscurrententrylevel<2 #2\fi |
| 61 |
} |
| 62 |
\printunsrtglossary[type=another] |
| 63 |
\end{document} |