Projekt

Allgemein

Profil

Accessibiliy Features » Historie » Version 29

Maren Pufe, 16.12.2024 11:04

1 1 Patrick Schulz
h1. Accessibiliy Features
2
3 20 Patrick Schulz
{{>toc}}
4
5 5 Patrick Schulz
h2. Activate Accessibility Features
6
7 28 Patrick Schulz
Add @a11y@ to the @\documentclass@ options:
8 25 Robert Hecht
<pre><code>\documentclass[…,a11y]{cocotex}
9 1 Patrick Schulz
</code></pre>
10
For PDF 2.0 use @a11y20@, instead.
11 28 Patrick Schulz
12
Make sure that the "env.sh":https://github.com/transpect/xerif-latex/blob/main/env.sh (part of the "xerif-latex":https://github.com/transpect/xerif-latex/tree/main repo) is sourced or that the Makefile includes the parameters defined this script. This is necessary so TeX finds the lua files from the @ltpdfa@ package.
13 25 Robert Hecht
14
h2. Set main language
15
16 27 Robert Hecht
Add @lang-id=XXX@ to the documentclass options following "ISO 639-2":https://de.wikipedia.org/wiki/Liste_der_ISO-639-2-Codes, e.g. for German:
17 25 Robert Hecht
<pre><code>\documentclass[…,lang-id=deu]{cocotex}
18
</code></pre>
19 5 Patrick Schulz
20 21 Maren Pufe
h2. Artifact tagging
21
22
Images and other contents that fulfill decorational purposes only must be tagged as artifacts to be ignored by reading software. This can be achieved as follows:
23
24
<pre><code class="tex">
25
\ccaStructStart{Artifact}Linie\ccaStructEnd{Artifact}
26
</code></pre>
27
28
* there exists also an environment that is not yet thoroughly tested:
29
30
<pre><code class="tex">
31
\begin{ccaArtifact}…\end{ccaArtifact}
32
</code></pre>
33
34
* consider tagging *decorational images*
35
* *writing lines* (if not tagged as forms)
36
* tbc
37
38 6 Patrick Schulz
h2. Paragraph tagging
39 1 Patrick Schulz
40 22 Patrick Schulz
Until further notice, text paragraphs need to be tagged by the converter by adding @\ccaVstructStart{P}@ at the beginning of each paragraph (no whitespaces between the macro and subsequent text or other macros!) and @\ccaVstructEnd{P}@ at the end of each paragraph (no whitespaces before @\ccaVstructEnd@!):
41 6 Patrick Schulz
<pre>
42 22 Patrick Schulz
\ccaVstructStart{P}Ipsum Lorem … finis.\ccaVstructEnd{P}
43 6 Patrick Schulz
</pre>
44
45 29 Maren Pufe
This must also be done in broader contexts that may(!) contain multiple paragraphs of plain text, like footnotes, captions, bibliographic references, list items, quotations, table cells or abstracts. Which ones exactly varies from publisher style to publisher style, so if in doubt, ask your friendly neighborhood TeX developer.
46 6 Patrick Schulz
47 7 Patrick Schulz
h2. Alternative Texts
48
49 8 Patrick Schulz
Figures and Math both need alternative texts.
50 7 Patrick Schulz
51
h4. Figures
52
53
For figures, there are two ways to encode alt-text: the @alt@ Parameter in the optional argument of @\includegraphics@ (needs texlive > 2021), e.g.
54
<pre>\incudegraphics[...,alt={This is what the image file shows}]{image.png}</pre>
55
or as @\tpAltText@ inside the @tpFigure@ or @tpSubFloat@ environments:
56
<pre>\begin{tpFigure}
57
  \tpCaption{This is the caption}
58
  \tpAltText{This is the alt text. It MUST NOT be the same as the caption!}
59
  \tpFig{\includegraphics{image.png}}
60 10 Patrick Schulz
\end{tpFigure}</pre>If both exist, the @alt@ in @\includegraphics@ takes precedence over the @\tpAltText@.
61 7 Patrick Schulz
62
h4. Math
63
64
both inline and display style math needs alternative texts. This is done with the @\ccaAddAltText@ macro:
65
<pre>
66
\begin{equation*}\ccaAddAltText{Z equals x minus mu divided by sigma}%
67
  \mathbf{Z}=\,\frac{\boldsymbol{x}-\mathbf{\mu }}{\mathbf{\sigma }}
68
\end{equation*}
69
</pre>
70
or, for inline math:
71
<pre>The Variable $x\addAltText{x}$ means...</pre>
72
73 1 Patrick Schulz
h2. XMP Meta Data
74 11 Patrick Schulz
75
* ***"Template.xmp":https://redmine.le-tex.de/attachments/27865***
76 1 Patrick Schulz
77 3 Patrick Schulz
PDF/UA requires meta data to be embedded into the PDF file. CoCoTeX provides two ways to do that: If the TeX run does not find a xmp file that has the same basename as the .tex document, it generates one from the data in the tpMeta environment. If there is a .xmp file (either because it was there from the beginning, or it was generated during a previous tex run), it includes that one. If the xmp file is to be generated by the converter, make sure to use the "attached template.xmp":https://redmine.le-tex.de/attachments/27865 (see below) and include the document specific meta data in line 24 instead of the comment.
78 1 Patrick Schulz
79 12 Patrick Schulz
***Important: Don't remove anything in that template, especially not the PIs at the beginning and end, and the blank spaces at the bottom of the template!***
80 1 Patrick Schulz
81
Also be cautious where to use @rdf:Bag@, @rdf:Alt@ and @rdf:Seq@!
82
83
Use the following XML tags for meta data:
84
85
86 4 Patrick Schulz
h4. Author
87 1 Patrick Schulz
88
is a list of the document's main authors or edtiors, one per line:
89
<pre><code class="xml">
90
<dc:creator>
91
  <rdf:Seq>
92
    <rdf:li>Firstname Lastname</rdf:li>
93
    <rdf:li>Firstname Lastname</rdf:li>
94
    ...
95
  </rdf:Seq>
96
</dc:creator>
97
</code></pre>
98
99 4 Patrick Schulz
h4. Document Title
100 1 Patrick Schulz
101
There can be more than one document title for various languages. The displayed title (e.g. in the pdf viewer window's top line) depends on the selected system language
102
103
<pre><code class="xml">
104
<dc:title>
105
  <rdf:Alt>
106
    <rdf:li xml:lang="x-default">Default title</rdf:li>
107
  </rdf:Alt>
108
</dc:title>
109
</code></pre>
110
111 4 Patrick Schulz
h4. Publisher
112 1 Patrick Schulz
113
<pre><code class="xml">
114
<dc:publisher>
115
  <rdf:Bag>
116
    <rdf:li>Publisher Name</rdf:li>
117
  </rdf:Bag>
118
</dc:publisher>
119
</code></pre>
120
121 4 Patrick Schulz
h4. Chapter authors/Contributors
122 1 Patrick Schulz
123
<pre><code class="xml">
124
<dc:contributor>
125
  <rdf:Bag>
126
    <rdf:li>Firstname Lastname</rdf:li>
127
    <rdf:li>Firstname Midname Lastname</rdf:li>
128
    ...
129
  </rdf:Bag>
130
</dc:contributor>
131
</code></pre>
132
133 4 Patrick Schulz
h4. Abstract
134 1 Patrick Schulz
135
Like @dc:title@, @dc:description@ allows multiple entries for different languages.
136
137
<pre><code class="xml">
138
<dc:description>
139
  <rdf:Alt>
140
    <rdf:li xml:lang="x-default">...</rdf:li>
141
  </rdf:Alt>
142
</dc:description>
143
</code></pre>
144
145 4 Patrick Schulz
h4. Keywords
146 1 Patrick Schulz
147
<pre><code class="xml">
148
<dc:subject>
149
  <rdf:Bag>
150
    <rdf:li>keyword 1</rdf:li>
151
    <rdf:li>keyword 2</rdf:li>
152
    ....
153
  </rdf:Bag>
154
</dc:subject>
155
</code></pre>
156
157
158 4 Patrick Schulz
h4. Copyright
159 1 Patrick Schulz
160
<pre><code class="xml">
161
<dc:rights>
162
  <rdf:Alt>
163
    <rdf:li xml:lang="x-default">Unless otherwise indicated, this work is licensed under a Creative Commons License Attribution 4.0 International. This does not apply to quoted content and works based on other permissions.</rdf:li>
164
  </rdf:Alt>
165
</dc:rights>
166
</code></pre>
167 4 Patrick Schulz
168
h4. Other
169
170
If you must, you can _alter_ the values of @<pdf:Producer>@ and @<xmp:CreatorTool>@, where @pdf:Producer@ is the tool that generated the PDF, and @xmp:CreatorTool@ is the Tool with which the original manuscript was created prior to any conversions or transformations.
171
172
The values of @xmp:ModifyDate@ and @xmp:CreateDate@ are generated and overwritten during the tex run by the ltpdfa package, so you can leave those fields as they are.
173 17 Patrick Schulz
174
h2. Colours and Embedded Images
175
176 18 Patrick Schulz
h3. Output Intent and Embedded ICC Colour Profiles
177
178
By default, CoCoTeX puts **CMYK** as output intent, but this can be overridden with the @color-env@ class option:
179
<pre><code class="latex">\documentclass[…,color-env=<space>,…]{cocotex}</code></pre>The Value @<space>@ should be one of the values in the left column of the following table:
180
181
|_. @<space>@ |_. icc profile|
182
| @srgb@, @rgb@ |  IEC 61966-2.1 Default RGB colour space - sRGB |
183
| @cmy@, @cmyk@ | Coated FOGRA39 |
184
| @grey@, @gray@ | ISO Coated v2 - GREY 1c - (basICColor) |
185
| @natural@, @none@ | (gray) |
186
187
Publisher-wide colour profile can be set with the @profile@ Property of the @titlepage@ Container:<pre><code class="latex">\ccAddToType{Properties}{titlepage}{%
188
    \ccSetProperty{output-intent}{%
189
      profile=<path to .icc file>;%
190
      components=<number of colour components>;%
191
      identifier=<name of colour profile>%
192
  }}</code></pre>with the following values:
193
* @<path to .icc file>@ is the path to the icc colour profile relative to the .tex file, including the file extension.
194
* @<number of colour components>@ is the number of colour components, e.g., @3@ for RGB, @4@ for CMYK, etc.
195
* @<name of colour profile>@ is the name of the colour profile (default values correspond to the right column in above's table)
196
197
A custom .icc profile valid only for the current document can be embedded with the following Components inside the @tpMeta@ environment:<pre><code class="latex">\begin{tpMeta}
198
199
  \tpIccProfileFile{<path to .icc file>}
200
  \tpIccComponents{<number of colour components>}
201
  \tpIccIdentifier{<name of colour profile>}
202
203
\end{tpMeta}</code></pre>
204
205
h3. Image files
206 1 Patrick Schulz
207 19 Patrick Schulz
The colour spaces of embedded images **must match the Output Indent of the PDF file** for the latter to be PDF/A2-a compatible. 
208 18 Patrick Schulz
209
A quick-and-dirty conversion can be done with imagemagick:<pre><code class="bash">magick <input>  -colorspace <color_space> -profile <path_to_icc> <output></code></pre>with
210
* @<input>@ the path to the input image
211
* @<color_space>@ the color space the image should be converted to (cmyk, rgb, etc)
212
* @<path_to_icc>@ the path to the icc profile that gets embedded into the image
213
* @<output>@ the name of the output image
214
215
h3. Custom Text Colours
216 17 Patrick Schulz
217
Custom document colours get automatically converted to the Output Intent color space by LaTeX, so they may be defined with any color model. The following colour definitions are roughly equivalent:<pre><code class="latex">\definecolor{myblue}{HTML}{3527FF}
218
\definecolor{myblue}{RGB}{53,39,255}
219
\definecolor{myblue}{rgb}{0.21,0.15,1}
220
\definecolor{myblue}{cmyk}{0.79,0.85,0,0}</code></pre>
221 24 Marcus Hottenroth
222
h2. Checking PDF/UA compliance on Linux
223
224
The main tool for validating the PDF/UA compliance of documents is the "PDF Accessibility Checker (PAC)":https://support.axes4.com/hc/de/articles/7371921627794-PDF-Accessibility-Checker-PAC-2024. Using it on Windows is rather straightforward but requires a few more steps to make it run on Linux. The following procedure has been tested successfully with Wine 7.0 and should work with later versions quite as well.
225
226
# Install <code>wine</code> and <code>winetricks</code> via your package manager. Ensure that it is at least Wine version 7.0.
227
# It is recommended to use a separate Wine prefix (i.e. a separate environment with its own configuration and installed Windows components/packages). To do so, issue <code>WINEPREFIX=~/.wine-pac wineboot --init</code>. The path <code>~/.wine_pac</code> is an example and may be replaced with a path to your liking.
228
# Install all fonts available for Wine (<code>corefonts</code> package won’t suffice) as well as .NET 4.8 by issuing <code>WINEPREFIX=~/.wine-pac winetricks --force dotnet48 allfonts</code>. The <code>--force</code> option is required, because <code>winetricks</code> will otherwise quit the installation with a warning, stating that the .NET 4.8 package may be broken since Wine release 5.0.
229
# After the installation routines of the aforementioned Windows software via Wine, you should now be able to run PAC via <code>WINEPREFIX=~/.wine-pac wine "/Path/to/your/PAC_directory/PAC.exe".