Debian Codegraph @

texmf-dist/doc/latex/glossaries-extra/samples/sample-autoindex-hyp.tex

raw
1 % arara: pdflatex
2 % arara: makeglossaries
3 % arara: pdflatex
4 % arara: makeindex
5 % arara: pdflatex
6 \documentclass[index=totoc]{scrreprt}
7
8 \usepackage[T1]{fontenc}
9
10 \usepackage{makeidx}
11 \usepackage[colorlinks,
12 hyperindex=false% necessary for the encap entry
13 ]{hyperref}
14 \usepackage[abbreviations]{glossaries-extra}
15
16 \renewcommand{\abbreviationsname}{List of Abbreviations}
17
18 \makeindex
19 \makeglossaries
20
21 % Provided by koma classes:
22 \setindexpreamble{Page numbers in bold indicate an entry
23 in the glossary or list of abbreviations.\par\medskip}
24
25 % Automatically index the location of entry in the glossary
26 % for those entries that are in the "general" category and
27 % use "htextbf" as the encap value:
28
29 % (Without the troublesome "encap" entry, hyperref's default
30 % hyperindex=true option could've been used and the attribute
31 % could simply be set to "textbf" and there'd be no need
32 % to define "htextbf".)
33
34 \glssetcategoryattribute{general}{indexname}{htextbf}
35 \glssetcategoryattribute{general}{dualindex}{hyperpage}
36
37 % Automatically index the location of entry in the glossary
38 % for those entries that are in the "abbreviation" category
39 % and use "htextbf" as the encap value:
40
41 \newcommand*{\htextbf}[1]{\textbf{\hyperpage{#1}}}
42 \glssetcategoryattribute{abbreviation}{indexname}{htextbf}
43 \glssetcategoryattribute{abbreviation}{dualindex}{hyperpage}
44
45 % Allow "format" key to override "dualindex" attribute.
46 \GlsXtrEnableIndexFormatOverride
47
48 % Convert the first letter of the name to upper case in the
49 % glossary for general entries:
50 \glssetcategoryattribute{general}{glossname}{firstuc}
51
52 % Convert the name to upper case in the glossary for
53 % abbreviations:
54 \glssetcategoryattribute{abbreviation}{glossname}{uc}
55
56 % Define general entries:
57
58 \newglossaryentry{duck}{name=duck,%
59 description={a waterbird with webbed feet}}
60
61 \newglossaryentry{parrot}{name=parrot,%
62 description={mainly tropical bird with bright plumage}}
63
64 \newglossaryentry{at}{name={@},%
65 description={makeindex's default for the ``actual value''}}
66
67 \newglossaryentry{level}{name={!},%
68 description={makeindex's default for the ``level value''}}
69
70 \newglossaryentry{esc}{name={"},%
71 description={makeindex's default for the ``escape value''}}
72
73 \newglossaryentry{encap}{name={|},%
74 description={makeindex's default for the ``encap value''}}
75
76 % Set abbreviation style:
77
78 \setabbreviationstyle{long-short-sc}
79
80 % Define abbreviations:
81
82 \newabbreviation
83 {html}% identifying label
84 {html}% short form
85 {hypertext markup language}% long form
86
87 \newabbreviation
88 {xml}% identifying label
89 {xml}% short form
90 {extensible markup language}% long form
91
92 \title{Sample document testing the glossaries-extra package}
93 \author{Nicola Talbot}
94
95 \begin{document}
96 \maketitle
97
98 \tableofcontents
99
100 \chapter{Introduction}
101
102 % If hyperref's default hyperindex=true option is in use
103 % the indexed term here won't need the |hyperpage bit.
104 This is a sample\index{sample|hyperpage} document testing the
105 \texttt{glossaries-extra} package.
106
107 \chapter{General Entries}
108
109 Sample entries: \gls{duck} and \gls{parrot}.
110
111 Test makeindex's special characters: \gls{at} (actual)
112 \gls{esc} (escape) \gls{level} (level) and \gls{encap} (encap).
113
114 \newpage
115
116 Use some entries again: \gls{duck} and \gls[format=hyperit]{parrot}.
117
118 \chapter{Abbreviations}
119
120 First use: \gls{html} and \gls{xml}.
121
122 Next use: \gls{html} and \gls{xml}.
123
124 \printglossaries
125
126 \printindex
127
128 \end{document}
129