summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/glossaries-extra/samples/sample-accsupp.tex
blob: 85d24a80598f06b9e48b45fe8cbce9cfbdae9f5f (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
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{cmap}

\usepackage[accsupp,% use glossaries-accsupp
 %nonumberlist,% suppress location list in glossary
 nopostdot=false% insert dot after description in glossary
]{glossaries-extra}

\makeglossaries

% Change the format of the location lists:
\renewcommand{\GlsXtrFormatLocationList}[1]{Page list: #1.}

% Default uses "ActualText" instead of "E". Redefine if required.
% Support in PDF viewers is variable.
%\renewcommand*{\glsaccsupp}[2]{%
%  \BeginAccSupp{E=#1}#2\EndAccSupp{}%
%}

\newabbreviation
 [% add accessibility information:
  %shortaccess={specific learning difference},% short access
  %access={specific learning difference},% name access
  textaccess={specific learning difference},% text access
 ]
 {spld}{SpLD}{specific learning difference}

\glssetcategoryattribute{initialism}{accessinsertdots}{true}
\glssetcategoryattribute{initialism}{nameshortaccess}{true}

\newabbreviation[category=initialism]{pi}{PI}{Private Investigator}

% \ensuremath is required in the following as the
% accessibility support clashes with math-mode.

% The firstaccess key defaults to the access key if omitted.
% This means that on first use if firstaccess hasn't been
% set but access has been set it will use the access text
% that's used for the name field in the glossary (not the
% value of the textaccess field). If this is inappropriate
% you need to explicitly add the firstaccess key.

\newglossaryentry{R}{name={\ensuremath{\Re}},
 access={set of real numbers symbol},% name access
 textaccess={set of real numbers},% text access
 %firstaccess={set of real numbers},% first access
 description={set of real numbers}}

\newglossaryentry{in}{name={\ensuremath{\in}},
 access={is element of set symbol},% name access
 textaccess={in},% text access
 %firstaccess={in},% first access
 description={is an element of}}

\begin{document}
This is a sample document testing the accsupp option.
If your PDF viewer doesn't provide a text-to-speech facility
try copying the text on this page and pasting to a text file 
to see the difference.

\section{An Abbreviation}

First use: \gls{spld}.
Next use: \gls{spld}.

Access name: \glsentryaccess{spld}.

Access text: \glsentrytextaccess{spld}.

Access short: \glsentryshortaccess{spld}.

If the access field isn't set in the above, no replacement text 
is used in the corresponding \verb|\glstext|, \verb|\glsaccesstext| etc commands.

Text field: \glstext{spld} [no-index/link version: \glsaccesstext{spld}].
Short field: \glsxtrshort{spld} [no-index/link version: \glsaccessshort{spld}].

\section{An Initialism}

The short form should be read as two letters: P I (not as the word
pi).

First use: \gls{pi}.
Next use: \gls{pi}.

Access short: \glsentryshortaccess{pi}.
Actual short value: \glsentryshort{pi}.
Access (name): \glsentryaccess{pi}.

\section{A Symbol}

First use: \gls{R}. Next use: \gls{R}.
Text field: \glstext{R}. Name field: \glsname{R}.

First use: \gls{in}. Next use: \gls{in}.
Text field: \glstext{in}. Name field: \glsname{in}.

Now test in math-mode:
\[
x \gls{in} \gls{R}
\]

The ``firstaccess'' field is used on first use. If this hasn't
been set the ``access'' field is used instead. The ``textaccess''
field is used on subsequent use. If this hasn't been set the
``access'' field is used instead. The ``access'' field is used
for the entry name in the glossary list.

Access (name) field: \glsentryaccess{R}.
First Access field: \glsentryfirstaccess{R}.
Text Access field: \glsentrytextaccess{R}.

Access (name) field: \glsentryaccess{in}.
First Access field: \glsentryfirstaccess{in}.
Text Access field: \glsentrytextaccess{in}.

\printglossaries

\end{document}