summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/glossaries/samples/sampleaccsupp.tex
blob: 26708ca37c31904f8c0b63ee4b3d3a90e575af0c (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
% This file is public domain
% If you want to use arara, you need the following directives:
% arara: pdflatex: { synctex: on }
% arara: makeglossaries
% arara: pdflatex: { synctex: on }
%
%http://mirrors.ctan.org/macros/latex/contrib/glossaries/glossaries-user.html#sampleaccsupp
%
% Note that this document isn't fully accessible as it's not tagged.
% See the accessibility or tagpdf packages for examples of how to tag the document.
\documentclass[a4paper]{article}

\usepackage[includemp,marginpar=1.5in,textwidth=5in]{geometry}
\usepackage{graphicx}
% use debug=showaccsupp to show replacement text in the margin
\usepackage[acronym]{glossaries-accsupp}

\makeglossaries

\setacronymstyle{long-short}

% These will use 'ActualText' rather than 'E' because the
% abbreviation is in the 'name' field.
\newglossaryentry{Doctor}{name=Dr,description={Doctor},access={Doctor}}

\newglossaryentry{Drive}{name={Dr.},description={Drive},access={Drive},
 plural={Drvs}}

% These will use 'E'
\newacronym{eg}{e.g.}{for example}

\newacronym[shortaccess={TiKZ ist kein Zeichenprogramm}]
{tikz}{Ti\emph{k}Z}{Ti\emph{k}Z ist \emph{kein} Zeichenprogramm}


% The symbol key needs to use 'ActualText' but the replacement text
% needs to be supplied as the hexadecimal character code.

\newcommand{\glssymbolaccsupp}[2]{%
 \glsaccessibility[method=hex,unicode]{ActualText}{#1}{#2}%
}

\newglossaryentry{int}{name={int},description={integral},
  symbol={\ensuremath{\int}},symbolaccess={222B}
}

% The user1 key needs to use 'Alt':
\newcommand{\glsuseriaccsupp}[2]{%
  \glsaccessibility{Alt}{#1}{#2}%
}

\newglossaryentry{sampleimage}{name={sample image},
 description={an example image},
% \protect is needed unless \glsnoexpandfields has been used
 user1={\protect\includegraphics[height=20pt]{example-image}},
 user1access={a boilerplate image used in examples}
}

\begin{document}

\section{General Terms}

Testing general terms that are really abbreviations.

\gls{Doctor} Smith lives at 2, Blueberry \gls{Drive}

\section{Symbols and Images}

Symbol: \glssymbol{int} (\gls{int}).

Image: \glsuseri{sampleimage} (\gls{sampleimage}).

\section{Abbreviations}

First use: \gls{eg}, \gls{tikz}.

Next use: \gls{eg}, \gls{tikz}.

Short: \acrshort{eg}, \acrshort{tikz}.

Long: \acrlong{eg}, \acrlong{tikz}.

Full: \acrfull{eg}, \acrfull{tikz}.

\printglossaries
\end{document}