summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/glossaries-extra/sample-autoindex-hyp.tex
blob: 2aeac3b5f4e42948c763cf55f2c4bf2e08a18f21 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
% arara: makeindex
% arara: pdflatex
\documentclass[index=totoc]{scrreprt}

\usepackage[T1]{fontenc}

\usepackage{makeidx}
\usepackage[colorlinks,
            hyperindex=false% necessary for the encap entry
            ]{hyperref}
\usepackage[abbreviations]{glossaries-extra}

\renewcommand{\abbreviationsname}{List of Abbreviations}

\makeindex
\makeglossaries

% Provided by koma classes:
\setindexpreamble{Page numbers in bold indicate an entry
in the glossary or list of abbreviations.\par\medskip}

% Automatically index the location of entry in the glossary
% for those entries that are in the "general" category and
% use "htextbf" as the encap value:

% (Without the troublesome "encap" entry, hyperref's default
% hyperindex=true option could've been used and the attribute
% could simply be set to "textbf" and there'd be no need
% to define "htextbf".)

\glssetcategoryattribute{general}{indexname}{htextbf}
\glssetcategoryattribute{general}{dualindex}{hyperpage}

% Automatically index the location of entry in the glossary
% for those entries that are in the "abbreviation" category
% and use "htextbf" as the encap value:

\newcommand*{\htextbf}[1]{\textbf{\hyperpage{#1}}}
\glssetcategoryattribute{abbreviation}{indexname}{htextbf}
\glssetcategoryattribute{abbreviation}{dualindex}{hyperpage}

% Allow "format" key to override "dualindex" attribute.
\GlsXtrEnableIndexFormatOverride

% Convert the first letter of the name to upper case in the 
% glossary for general entries:
\glssetcategoryattribute{general}{glossname}{firstuc}

% Convert the name to upper case in the glossary for
% abbreviations:
\glssetcategoryattribute{abbreviation}{glossname}{uc}

% Define general entries:

\newglossaryentry{duck}{name=duck,%
  description={a waterbird with webbed feet}}

\newglossaryentry{parrot}{name=parrot,%
  description={mainly tropical bird with bright plumage}}

\newglossaryentry{at}{name={@},%
  description={makeindex's default for the ``actual value''}}

\newglossaryentry{level}{name={!},%
  description={makeindex's default for the ``level value''}}

\newglossaryentry{esc}{name={"},%
  description={makeindex's default for the ``escape value''}}

\newglossaryentry{encap}{name={|},%
  description={makeindex's default for the ``encap value''}}

% Set abbreviation style:

\setabbreviationstyle{long-short-sc}

% Define abbreviations:

\newabbreviation
 {html}% identifying label
 {html}% short form
 {hypertext markup language}% long form

\newabbreviation
 {xml}% identifying label
 {xml}% short form
 {extensible markup language}% long form

\title{Sample document testing the glossaries-extra package}
\author{Nicola Talbot}

\begin{document}
\maketitle

\tableofcontents

\chapter{Introduction}

% If hyperref's default hyperindex=true option is in use
% the indexed term here won't need the |hyperpage bit.
This is a sample\index{sample|hyperpage} document testing the
\texttt{glossaries-extra} package.

\chapter{General Entries}

Sample entries: \gls{duck} and \gls{parrot}.

Test makeindex's special characters: \gls{at} (actual)
\gls{esc} (escape) \gls{level} (level) and \gls{encap} (encap).

\newpage

Use some entries again: \gls{duck} and \gls[format=hyperit]{parrot}.

\chapter{Abbreviations}

First use: \gls{html} and \gls{xml}.

Next use: \gls{html} and \gls{xml}.

\printglossaries

\printindex

\end{document}