Debian Codegraph @

texmf-dist/doc/latex/tagpdf/ex-alt-actualtext.tex

raw
1 % !Mode:: "TeX:DE:UTF-8:Main"
2
3
4 \DocumentMetadata{pdfversion=1.7,lang=de,tagging=on}
5 \documentclass{article}
6 \tagpdfsetup{tabsorder=structure}
7 \usepackage{iftex}
8 \iftutex
9 \usepackage{fontspec}
10 \usepackage{unicode-math}
11 \usepackage{luacode}
12 \newfontface\zerowidthfont{freeserif}
13 \else
14 \usepackage[T1]{fontenc}
15 \fi
16
17
18 \usepackage{graphicx}
19 % This is not a perfectly tagged document!
20 % example and comments are from <2022, results can be different now
21 % It doesn't use paratagging!
22 % one sentence is not marked (luatex will mark it as artifact)
23 % with pdflatex there is a encoding problem with the math
24 %
25 \begin{document}
26 \tagpdfparaOff
27 \pagestyle{empty}
28
29 %This isn't read by voice software
30 Etwas unmarkierter Text.
31
32 %This read ok by voice software
33 \tagstructbegin{tag=P}
34 \tagmcbegin{tag=P}
35 Ein Satz ohne Umlaute.
36 \tagmcend
37 \tagstructend
38
39 %This read ok by nvda, but adobe has difficulties with the umlauts
40 \tagstructbegin{tag=P}
41 \tagmcbegin{tag=P}
42 Grüße an die Welt und die öde Wüste.
43 \tagmcend
44 \tagstructend
45
46 \newpage
47 % alttext is read,
48 % actualtext copy & pasted
49 \tagstructbegin{tag=P,alttext=Dies ist ein Text,actualtext=Copy}
50 \tagmcbegin{tag=P}
51 Test
52 \tagmcend
53 \tagstructend
54
55 %alttext is read,
56 %actualtext copy & pasted
57 \tagstructbegin{tag=P}
58 \tagmcbegin{tag=P,alttext=Dies ist ein zweiter Text,actualtext=Copy}
59 Test
60 \tagmcend
61 \tagstructend
62
63
64 %nvda: alttext of structure is read
65 %adobe: alttext of inner mc is read
66 % result of copy & paste of this page in adobe reader:
67 % why twice??????
68 % Copy Copy
69 % Copy Copy
70 % Copystruct Copystruct
71
72 \tagstructbegin{tag=P,alttext=Dies ist der Structuretext,actualtext=Copystruct}
73 \tagmcbegin{tag=P,alttext=Dies ist der innere Text,actualtext=Copymc}
74 Test
75 \tagmcend
76 \tagstructend
77
78
79
80 \newpage
81 % test of "Formula" tag:
82 % content is more or less ignored. This is not against the documentation:
83 % Formula is explicitly describes as an "illustration", something with a content
84 % which can not be read directly.
85 % But it is a problem that nvda ignores it even with an alt text.
86
87 %test of Formula tag + alttext in the mc
88 %pdflatex
89 %nvda: content is ignored
90 %adobe: reads the alt text but without {} and ()
91
92 %luatex (unicode-math):
93 % nvda: doesn't read
94 %adobe: doesn't read (warning "empty page")
95
96 \tagstructbegin{tag=Formula}
97 \tagmcbegin {tag=Formula,alttext={\frac{a}{b}+c + \int_1^n f(x)}}
98 xxx $\frac{a}{b}+c + \int_1^n f(x)$
99 \tagmcend
100 \tagstructend
101
102 \newpage
103
104 %test of Formula tag + alttext in the struct
105 \tagstructbegin{tag=Formula,alttext=Dies ist eine Formel}
106 \tagmcbegin {tag=Formula}
107 formula
108 \tagmcend
109 \tagstructend
110
111 \newpage
112 % test of Formula tag without alttext
113 % pdflatex
114 % adobe: reads it more or less (without commands naturally)
115 % nvda: ignores it
116
117 %lualatex
118 %nvda: ignores it
119 %adobe: ignores it
120
121 \tagstructbegin{tag=Formula}
122 \tagmcbegin {tag=Formula}
123 formula: $\frac{a}{b}+c + \int_1^n f(x)$
124 \tagmcend
125 \tagstructend
126
127 \newpage
128 % luatex:
129 % nvda: reads the alttext ok, {} and () are only read if the symbol level is (at leat) "most"
130 % adobe: something is read but it is not understable
131
132 \tagstructbegin{tag=P}
133 \tagmcbegin {tag=P,alttext={\frac{x}{y}+c + \int_1^n f(x)}}
134 $\frac{x}{y}+c + \int_1^n f(x)$
135 \tagmcend
136 \tagstructend
137
138 %pdftex
139 % sum is read as "pi"
140 %luatex
141 %adobe: almost nothing read (only 1 and =)
142 %nvda: similar, obviously both have problems with the unicode math symbols
143 \tagstructbegin{tag=P}
144 \tagmcbegin {tag=P}
145 $\sum_1^n (1) = n $
146 \tagmcend
147 \tagstructend
148
149 \newpage
150
151 \tagmcbegin{tag=P,
152 actualtext=Ente,
153 alttext=Dies ist eine Ente}
154 %% a char is needed so that actualtext works,
155 \ifluatex
156 {{\zerowidthfont^^^^200c}}%
157 \else {\makebox[0pt][l]{.}} \fi%
158 %it seems not to be needed for alttext and voice software ....
159 \includegraphics[width=1cm]{example-image-duck}
160 \tagmcend
161
162 \tagmcbegin{tag=P,
163 actualtext=Ente,
164 alttext=Dies ist eine zweite Ente}
165 %% a char is needed so that actualtext works,
166 %\tagpdfifluatexTF
167 % {{\zerowidthfont^^^^200c}}%
168 % {\makebox[0pt][l]{.}}%
169 %it seems not to be needed for alttext and voice software ....
170 \includegraphics[width=1cm]{example-image-duck}
171 \tagmcend
172
173
174 \end{document}