% 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}
