Projekt

Allgemein

Profil

Accessibiliy Features » Historie » Version 34

Maren Pufe, 08.05.2025 15:28

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 31 Maren Pufe
This must also be done in broader contexts that may(!) contain multiple paragraphs of plain text, like 
46
* footnotes, 
47
* captions, 
48
* bibliographic references, 
49
* list items, 
50
* quotations, 
51
* table cells or 
52
* abstracts. Which ones exactly varies from publisher style to publisher style, so if in doubt, ask your friendly neighborhood TeX developer.
53 6 Patrick Schulz
54 7 Patrick Schulz
h2. Alternative Texts
55
56 8 Patrick Schulz
Figures and Math both need alternative texts.
57 7 Patrick Schulz
58
h4. Figures
59
60
For figures, there are two ways to encode alt-text: the @alt@ Parameter in the optional argument of @\includegraphics@ (needs texlive > 2021), e.g.
61
<pre>\incudegraphics[...,alt={This is what the image file shows}]{image.png}</pre>
62
or as @\tpAltText@ inside the @tpFigure@ or @tpSubFloat@ environments:
63
<pre>\begin{tpFigure}
64
  \tpCaption{This is the caption}
65
  \tpAltText{This is the alt text. It MUST NOT be the same as the caption!}
66
  \tpFig{\includegraphics{image.png}}
67 10 Patrick Schulz
\end{tpFigure}</pre>If both exist, the @alt@ in @\includegraphics@ takes precedence over the @\tpAltText@.
68 7 Patrick Schulz
69
h4. Math
70
71
both inline and display style math needs alternative texts. This is done with the @\ccaAddAltText@ macro:
72 33 Maren Pufe
<pre><code class="tex">
73 34 Maren Pufe
\ccaStructStart{P}\begin{equation*}\ccaAddAltText{Z equals x minus mu divided by sigma}%
74 7 Patrick Schulz
  \mathbf{Z}=\,\frac{\boldsymbol{x}-\mathbf{\mu }}{\mathbf{\sigma }}
75 1 Patrick Schulz
\end{equation*}
76 34 Maren Pufe
\ccaStructStart{P}
77 33 Maren Pufe
</code></pre>
78
79 7 Patrick Schulz
or, for inline math:
80 33 Maren Pufe
<pre><code class="tex">The Variable  \ccaStructStart{Formula}$x\addAltText{x}$\ccaStructEnd{Formula} means...</code></pre>
81 1 Patrick Schulz
82 32 Maren Pufe
or
83
84 1 Patrick Schulz
<pre><code class="tex">The Variable\(x\ccaAddAltText{alternative text}\).</code></pre>
85 32 Maren Pufe
86 34 Maren Pufe
(in @\(...)\@ the tagging is already included).
87 32 Maren Pufe
88 1 Patrick Schulz
h2. XMP Meta Data
89 11 Patrick Schulz
90 30 Patrick Schulz
_(see [[XMP Meta Data]])_
91 17 Patrick Schulz
92
h2. Colours and Embedded Images
93
94 18 Patrick Schulz
h3. Output Intent and Embedded ICC Colour Profiles
95
96
By default, CoCoTeX puts **CMYK** as output intent, but this can be overridden with the @color-env@ class option:
97
<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:
98
99
|_. @<space>@ |_. icc profile|
100
| @srgb@, @rgb@ |  IEC 61966-2.1 Default RGB colour space - sRGB |
101
| @cmy@, @cmyk@ | Coated FOGRA39 |
102
| @grey@, @gray@ | ISO Coated v2 - GREY 1c - (basICColor) |
103
| @natural@, @none@ | (gray) |
104
105
Publisher-wide colour profile can be set with the @profile@ Property of the @titlepage@ Container:<pre><code class="latex">\ccAddToType{Properties}{titlepage}{%
106
    \ccSetProperty{output-intent}{%
107
      profile=<path to .icc file>;%
108
      components=<number of colour components>;%
109
      identifier=<name of colour profile>%
110
  }}</code></pre>with the following values:
111
* @<path to .icc file>@ is the path to the icc colour profile relative to the .tex file, including the file extension.
112
* @<number of colour components>@ is the number of colour components, e.g., @3@ for RGB, @4@ for CMYK, etc.
113
* @<name of colour profile>@ is the name of the colour profile (default values correspond to the right column in above's table)
114
115
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}
116
117
  \tpIccProfileFile{<path to .icc file>}
118
  \tpIccComponents{<number of colour components>}
119
  \tpIccIdentifier{<name of colour profile>}
120
121
\end{tpMeta}</code></pre>
122
123
h3. Image files
124 1 Patrick Schulz
125 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. 
126 18 Patrick Schulz
127
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
128
* @<input>@ the path to the input image
129
* @<color_space>@ the color space the image should be converted to (cmyk, rgb, etc)
130
* @<path_to_icc>@ the path to the icc profile that gets embedded into the image
131
* @<output>@ the name of the output image
132
133
h3. Custom Text Colours
134 17 Patrick Schulz
135
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}
136
\definecolor{myblue}{RGB}{53,39,255}
137
\definecolor{myblue}{rgb}{0.21,0.15,1}
138
\definecolor{myblue}{cmyk}{0.79,0.85,0,0}</code></pre>
139 24 Marcus Hottenroth
140
h2. Checking PDF/UA compliance on Linux
141
142
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.
143
144
# Install <code>wine</code> and <code>winetricks</code> via your package manager. Ensure that it is at least Wine version 7.0.
145
# 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.
146
# 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.
147
# 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".