Debian Codegraph @

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

raw
1 % arara: pdflatex
2 % arara: makeglossaries
3 % arara: pdflatex
4 \documentclass{article}
5
6 \usepackage[T1]{fontenc}
7 \usepackage{cmap}
8
9 \usepackage[accsupp,% use glossaries-accsupp
10 %nonumberlist,% suppress location list in glossary
11 nopostdot=false% insert dot after description in glossary
12 ]{glossaries-extra}
13
14 \makeglossaries
15
16 % Change the format of the location lists:
17 \renewcommand{\GlsXtrFormatLocationList}[1]{Page list: #1.}
18
19 % Default uses "ActualText" instead of "E". Redefine if required.
20 % Support in PDF viewers is variable.
21 %\renewcommand*{\glsaccsupp}[2]{%
22 % \BeginAccSupp{E=#1}#2\EndAccSupp{}%
23 %}
24
25 \newabbreviation
26 [% add accessibility information:
27 %shortaccess={specific learning difference},% short access
28 %access={specific learning difference},% name access
29 textaccess={specific learning difference},% text access
30 ]
31 {spld}{SpLD}{specific learning difference}
32
33 \glssetcategoryattribute{initialism}{accessinsertdots}{true}
34 \glssetcategoryattribute{initialism}{nameshortaccess}{true}
35
36 \newabbreviation[category=initialism]{pi}{PI}{Private Investigator}
37
38 % \ensuremath is required in the following as the
39 % accessibility support clashes with math-mode.
40
41 % The firstaccess key defaults to the access key if omitted.
42 % This means that on first use if firstaccess hasn't been
43 % set but access has been set it will use the access text
44 % that's used for the name field in the glossary (not the
45 % value of the textaccess field). If this is inappropriate
46 % you need to explicitly add the firstaccess key.
47
48 \newglossaryentry{R}{name={\ensuremath{\Re}},
49 access={set of real numbers symbol},% name access
50 textaccess={set of real numbers},% text access
51 %firstaccess={set of real numbers},% first access
52 description={set of real numbers}}
53
54 \newglossaryentry{in}{name={\ensuremath{\in}},
55 access={is element of set symbol},% name access
56 textaccess={in},% text access
57 %firstaccess={in},% first access
58 description={is an element of}}
59
60 \begin{document}
61 This is a sample document testing the accsupp option.
62 If your PDF viewer doesn't provide a text-to-speech facility
63 try copying the text on this page and pasting to a text file
64 to see the difference.
65
66 \section{An Abbreviation}
67
68 First use: \gls{spld}.
69 Next use: \gls{spld}.
70
71 Access name: \glsentryaccess{spld}.
72
73 Access text: \glsentrytextaccess{spld}.
74
75 Access short: \glsentryshortaccess{spld}.
76
77 If the access field isn't set in the above, no replacement text
78 is used in the corresponding \verb|\glstext|, \verb|\glsaccesstext| etc commands.
79
80 Text field: \glstext{spld} [no-index/link version: \glsaccesstext{spld}].
81 Short field: \glsxtrshort{spld} [no-index/link version: \glsaccessshort{spld}].
82
83 \section{An Initialism}
84
85 The short form should be read as two letters: P I (not as the word
86 pi).
87
88 First use: \gls{pi}.
89 Next use: \gls{pi}.
90
91 Access short: \glsentryshortaccess{pi}.
92 Actual short value: \glsentryshort{pi}.
93 Access (name): \glsentryaccess{pi}.
94
95 \section{A Symbol}
96
97 First use: \gls{R}. Next use: \gls{R}.
98 Text field: \glstext{R}. Name field: \glsname{R}.
99
100 First use: \gls{in}. Next use: \gls{in}.
101 Text field: \glstext{in}. Name field: \glsname{in}.
102
103 Now test in math-mode:
104 \[
105 x \gls{in} \gls{R}
106 \]
107
108 The ``firstaccess'' field is used on first use. If this hasn't
109 been set the ``access'' field is used instead. The ``textaccess''
110 field is used on subsequent use. If this hasn't been set the
111 ``access'' field is used instead. The ``access'' field is used
112 for the entry name in the glossary list.
113
114 Access (name) field: \glsentryaccess{R}.
115 First Access field: \glsentryfirstaccess{R}.
116 Text Access field: \glsentrytextaccess{R}.
117
118 Access (name) field: \glsentryaccess{in}.
119 First Access field: \glsentryfirstaccess{in}.
120 Text Access field: \glsentrytextaccess{in}.
121
122 \printglossaries
123
124 \end{document}