| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
%% File: latex-lab-namespace.dtx |
| 4 |
%% |
| 5 |
% Copyright (C) 2023-2026 LaTeX Project |
| 6 |
% |
| 7 |
% It may be distributed and/or modified under the conditions of the |
| 8 |
% LaTeX Project Public License (LPPL), either version 1.3c of this |
| 9 |
% license or (at your option) any later version. The latest version |
| 10 |
% of this license is in the file |
| 11 |
% |
| 12 |
% https://www.latex-project.org/lppl.txt |
| 13 |
% |
| 14 |
%<*package> |
| 15 |
\def\ltlabnamesdate{2026-04-28} |
| 16 |
\def\ltlabnamesversion{0.8k} |
| 17 |
%</package> |
| 18 |
%<*driver> |
| 19 |
\DocumentMetadata{tagging=on,pdfstandard=ua-2} |
| 20 |
\documentclass[kernel]{l3in2edoc} |
| 21 |
|
| 22 |
\usepackage{amstext} |
| 23 |
\EnableCrossrefs |
| 24 |
\CodelineIndex |
| 25 |
|
| 26 |
\usepackage{todonotes} |
| 27 |
|
| 28 |
\begin{document} |
| 29 |
\DocInput{latex-lab-namespace.dtx} |
| 30 |
\end{document} |
| 31 |
%</driver> |
| 32 |
% \fi |
| 33 |
% \title{Prototype reimplementation of \LaTeXe{}'s role mapping} |
| 34 |
% \author{\LaTeX{} Project, initial implementation Ulrike Fischer} |
| 35 |
% \date{v\ltlabnamesversion\ \ltlabnamesdate} |
| 36 |
% |
| 37 |
% \maketitle |
| 38 |
% |
| 39 |
% \NewDocumentCommand\fmi{sO{}m} |
| 40 |
% {\IfBooleanTF{#1}{\todo[inline,#2]{#3}}^^A |
| 41 |
% {\todo[#2]{#3}}} |
| 42 |
% |
| 43 |
% % \NewDocumentCommand\ufi{sO{}m} |
| 44 |
% {\IfBooleanTF{#1}{\todo[inline,#2]{UFi:#3}}^^A |
| 45 |
% {\todo[#2]{UFi:#3}}} |
| 46 |
% \begin{documentation} |
| 47 |
% |
| 48 |
% |
| 49 |
% |
| 50 |
% \section{Introduction} |
| 51 |
% |
| 52 |
% This file provides support for tag names and symbolic structure names. |
| 53 |
% |
| 54 |
% At first, it creates tagpdf-ns-latex-lab.def which collects tag names |
| 55 |
% from the \LaTeX{} namespace and their role mapping. |
| 56 |
% The names and the roles are not necessarily the final ones! |
| 57 |
% |
| 58 |
% Later settings of the same tag overwrite previous settings. |
| 59 |
% The syntax of a line is a list of three strings ending with commas: |
| 60 |
% \begin{verbatim} |
| 61 |
% latex-tag, PDF-tag, name space, |
| 62 |
% \end{verbatim} |
| 63 |
% |
| 64 |
% The name space is normally pdf2 with the exception of the following PDF-tags |
| 65 |
% which are only in pdf namespace: |
| 66 |
% Art, BlockQuote, TOC, TOCI, Index, Private, Quote, Note, |
| 67 |
% Reference, BibEntry, Code. |
| 68 |
% |
| 69 |
% At second it provides an interface to use symbolic structure names |
| 70 |
% which can be used in the \texttt{tag} key of \cs{tagstructbegin}. |
| 71 |
% The symbolic names are strings |
| 72 |
% structured with slashes similar to the names of (tagging) sockets. |
| 73 |
% The list of such names used by \LaTeX{} is below in the implementation section. |
| 74 |
% |
| 75 |
% In PDF 2.0 there are namespaces, so theoretically it is possible to use the |
| 76 |
% same tag name for different purposes and with different role mapping. |
| 77 |
% But practically this is not an option as we build also a global RoleMap |
| 78 |
% dictionary for compatibility with applications that are not PDF 2.0 aware, |
| 79 |
% and this dictionary can only contain unique tag names. So we assume that tag |
| 80 |
% names are used only once across all namespaces. Documents that want to use |
| 81 |
% their own specialized tag names must take care not to clash with existing names, |
| 82 |
% e.g., by using a specific prefix on all their tag names. |
| 83 |
% |
| 84 |
% \begin{function}{\NewStructureName} |
| 85 |
% \begin{syntax} |
| 86 |
% \cs{NewStructureName}\Arg{symbolic name} |
| 87 |
% \end{syntax} |
| 88 |
% This declares a new symbolic |
| 89 |
% structure name \meta{symbolic name} which is initially |
| 90 |
% defined as \texttt{NonStruct}. To assign it another role use |
| 91 |
% \cs{AssignStructureRole} described below. |
| 92 |
% \end{function} |
| 93 |
% |
| 94 |
% \begin{function}[EXP]{\UseStructureName} |
| 95 |
% \begin{syntax} |
| 96 |
% \cs{UseStructureName}\Arg{symbolic name} |
| 97 |
% \end{syntax} |
| 98 |
% This uses the new symbolic structure name \meta{symbolic name}, e.g.\\ |
| 99 |
% \verb+tagstructbegin{tag=\UseStructureName{sec/section}}+ is the same as |
| 100 |
% \verb+tagstructbegin{tag=Sect}+ assuming that |
| 101 |
% \verb+\NewStructureName{sec/section}+ and \verb+\AssignStructureRole{sec/section}{Sect}+ |
| 102 |
% has been used before. |
| 103 |
% \end{function} |
| 104 |
% |
| 105 |
% \begin{function}{\AssignStructureRole} |
| 106 |
% \begin{syntax} |
| 107 |
% \cs{AssignStructureRole}\Arg{symbolic name}\Arg{role} |
| 108 |
% \end{syntax} |
| 109 |
% This assigns to the symbolic structure name \meta{symbolic name} the role \meta{role}. |
| 110 |
% \meta{symbolic name} must have been declared first with \verb+\NewStructureName+. |
| 111 |
% If \meta{role} is a known role it is simply used. If it is unknown, it is declared |
| 112 |
% first and rolemapped to the tag currently stored for \meta{name}. So |
| 113 |
% \begin{verbatim} |
| 114 |
% \NewStructureName{sec/section} |
| 115 |
% % structure with tag 'NonStruct' |
| 116 |
% \tagstructbegin{tag=\UseStructureName{sec/section}} |
| 117 |
% |
| 118 |
% \AssignStructureRole{sec/section}{Sect} |
| 119 |
% % structure with tag 'Sect' |
| 120 |
% \tagstructbegin{tag=\UseStructureName{sec/section}} |
| 121 |
% |
| 122 |
% \AssignStructureRole{sec/section}{Abschnitt} |
| 123 |
% % structure with tag 'Abschnitt' rolemapped to 'Sect' |
| 124 |
% \tagstructbegin{tag=\UseStructureName{sec/section}} |
| 125 |
% |
| 126 |
% \AssignStructureRole{sec/section}{Figure} |
| 127 |
% % structure with tag 'Figure' |
| 128 |
% \tagstructbegin{tag=\UseStructureName{sec/section}} |
| 129 |
% \end{verbatim} |
| 130 |
% |
| 131 |
% Assigning a symbolic structure name a role that is not suitable for the |
| 132 |
% structure element can lead to invalid tagging and parent-child warnings! |
| 133 |
% \end{function} |
| 134 |
% \end{documentation} |
| 135 |
% |
| 136 |
% \begin{implementation} |
| 137 |
% \changes{v0.8c}{2025/01/12}{changed mapping of verbatim to Code as Sub is now allowed inside Code} |
| 138 |
% \begin{macrocode} |
| 139 |
%<*ns-latex-lab> |
| 140 |
%% \ProvidesExplFile {tagpdf-ns-latex-lab.def} {2023-09-04} {0.8} |
| 141 |
%% {latex} {https://www.latex-project.org/ns/lab/2022}{} |
| 142 |
% \end{macrocode} |
| 143 |
% \subsection{Role from tagpdf} |
| 144 |
% The following tags are already set by tagpdf, so deleting here will not remove them. |
| 145 |
% \begin{macrocode} |
| 146 |
title, Title, pdf2, |
| 147 |
part, Title, pdf2, |
| 148 |
% \end{macrocode} |
| 149 |
% Headings differ in article and book class. This here is for article: |
| 150 |
% \begin{macrocode} |
| 151 |
section, H1, pdf2, |
| 152 |
subsection, H2, pdf2, |
| 153 |
subsubsection,H3, pdf2, |
| 154 |
paragraph, H4, pdf2, |
| 155 |
subparagraph, H5, pdf2, |
| 156 |
% \end{macrocode} |
| 157 |
% And this here is used in book: |
| 158 |
% \begin{macrocode} |
| 159 |
%chapter, H1, pdf2, |
| 160 |
%section, H2, pdf2, |
| 161 |
%subsection, H3, pdf2, |
| 162 |
%subsubsection, H4, pdf2, |
| 163 |
%paragraph, H5, pdf2, |
| 164 |
%subparagraph, H6, pdf2, |
| 165 |
% \end{macrocode} |
| 166 |
% |
| 167 |
% \begin{macrocode} |
| 168 |
list, L, pdf2, |
| 169 |
itemize, L, pdf2, |
| 170 |
enumerate, L, pdf2, |
| 171 |
description, L, pdf2, |
| 172 |
quote, BlockQuote,pdf, |
| 173 |
quotation, BlockQuote,pdf, |
| 174 |
verbatim, Code, pdf, % overwritten by block |
| 175 |
item, LI, pdf2, |
| 176 |
itemlabel, Lbl, pdf2, |
| 177 |
itembody, LBody, pdf2, |
| 178 |
footnote, FENote, pdf2, |
| 179 |
footnotemark, Lbl, pdf2, |
| 180 |
footnotelabel,Lbl, pdf2, |
| 181 |
text-unit, Part, pdf2, |
| 182 |
text, P, pdf2, |
| 183 |
% \end{macrocode} |
| 184 |
% \subsection{From sec code} |
| 185 |
% \begin{macrocode} |
| 186 |
section-number, Span, pdf2, |
| 187 |
% \end{macrocode} |
| 188 |
% \subsection{From block code} |
| 189 |
% \begin{macrocode} |
| 190 |
theorem-like, Sect, pdf2, |
| 191 |
verbatim, Code, pdf, |
| 192 |
codeline, Sub, pdf2, |
| 193 |
% \end{macrocode} |
| 194 |
% \subsection{From float code} |
| 195 |
% \begin{macrocode} |
| 196 |
float, Aside, pdf2, |
| 197 |
figures, Sect, pdf2, |
| 198 |
tables, Sect, pdf2, |
| 199 |
% \end{macrocode} |
| 200 |
% \begin{macrocode} |
| 201 |
%</ns-latex-lab> |
| 202 |
% \end{macrocode} |
| 203 |
% |
| 204 |
% \begin{macrocode} |
| 205 |
%<*package> |
| 206 |
\ProvidesExplPackage {latex-lab-testphase-names} {\ltlabnamesdate} {\ltlabnamesversion} |
| 207 |
{Code related to the names of tags} |
| 208 |
% \end{macrocode} |
| 209 |
% \begin{macrocode} |
| 210 |
%<@@=tag> |
| 211 |
% \end{macrocode} |
| 212 |
% |
| 213 |
% |
| 214 |
% \begin{macro}{\AssignStructureRole} |
| 215 |
% We redefine \cs{AssignStructureRole} to set up roles for tagging. |
| 216 |
% The second argument needs expansion so that we do |
| 217 |
% not store things like |
| 218 |
% \verb=\UseStructureName{block/verbatim/codeline}}= but its final |
| 219 |
% value. Otherwise \ldots\fmi{fix implementation and docu} |
| 220 |
% \changes{v0.8h}{2025/12/23}{Expand second argument before storing} |
| 221 |
% \begin{macrocode} |
| 222 |
\cs_set_protected:Npn\AssignStructureRole#1#2 { |
| 223 |
\exp_args:Nne \@@_AssignStructureRole {#1}{#2} |
| 224 |
} |
| 225 |
\cs_set_protected:Npn\@@_AssignStructureRole#1#2 |
| 226 |
{ |
| 227 |
\prop_get:NnNF\g_@@_role_tags_NS_prop{#2}\l_@@_tmp_unused_tl |
| 228 |
{\exp_args:Ne\tagpdfsetup{role/new-tag=#2/\UseStructureName{#1}}} |
| 229 |
\tl_set:cn { l_@@_name_#1_tl }{#2} |
| 230 |
} |
| 231 |
% \end{macrocode} |
| 232 |
% \end{macro} |
| 233 |
% |
| 234 |
% |
| 235 |
% \begin{macrocode} |
| 236 |
%</package> |
| 237 |
% \end{macrocode} |
| 238 |
% |
| 239 |
% \subsection{Symbolic names} |
| 240 |
% These are the planned symbolic structure names. |
| 241 |
% Every commented name is not decided and not used yet and can change in future. |
| 242 |
% |
| 243 |
% \subsubsection{Generic} |
| 244 |
% In various places we have to use a \texttt{Span} structure |
| 245 |
% to add attributes. |
| 246 |
% \begin{macrocode} |
| 247 |
%<*package> |
| 248 |
\NewStructureName{span} |
| 249 |
\AssignStructureRole{span}{Span} |
| 250 |
%</package> |
| 251 |
% \end{macrocode} |
| 252 |
% |
| 253 |
% \subsubsection{Paragraphs} |
| 254 |
% |
| 255 |
% \begin{macrocode} |
| 256 |
%<*package> |
| 257 |
\NewStructureName{para/textblock} |
| 258 |
\AssignStructureRole{para/textblock}{text} |
| 259 |
\NewStructureName{para/semantic} |
| 260 |
\AssignStructureRole{para/semantic}{text-unit} |
| 261 |
%</package> |
| 262 |
% \end{macrocode} |
| 263 |
% |
| 264 |
% \subsubsection{Sectioning commands} |
| 265 |
% \begin{macrocode} |
| 266 |
%<*package> |
| 267 |
%-1=part, 0=chapter, 1=section etc |
| 268 |
\NewStructureName{sec/-1} |
| 269 |
\AssignStructureRole{sec/-1}{Part} |
| 270 |
\NewStructureName{sec/-1/title} |
| 271 |
\AssignStructureRole{sec/-1/title}{part} |
| 272 |
\NewStructureName{sec/-1/titleline} |
| 273 |
% \end{macrocode} |
| 274 |
% Sub does not work as part is rolemapped to Title so we use Span |
| 275 |
% \begin{macrocode} |
| 276 |
\AssignStructureRole{sec/-1/titleline}{Span} |
| 277 |
\NewStructureName{sec/-1/number} |
| 278 |
\AssignStructureRole{sec/-1/number}{section-number} |
| 279 |
\NewStructureName{sec/0} |
| 280 |
\AssignStructureRole{sec/0}{Sect} |
| 281 |
\NewStructureName{sec/0/title} |
| 282 |
\AssignStructureRole{sec/0/title}{chapter} |
| 283 |
\NewStructureName{sec/0/titleline} |
| 284 |
\AssignStructureRole{sec/0/titleline}{Span} |
| 285 |
\NewStructureName{sec/0/number} |
| 286 |
\AssignStructureRole{sec/0/number}{section-number} |
| 287 |
\NewStructureName{sec/1} |
| 288 |
\AssignStructureRole{sec/1}{Sect} |
| 289 |
\NewStructureName{sec/1/title} |
| 290 |
\AssignStructureRole{sec/1/title}{section} |
| 291 |
\NewStructureName{sec/1/number} |
| 292 |
\AssignStructureRole{sec/1/number}{section-number} |
| 293 |
\NewStructureName{sec/2} |
| 294 |
\AssignStructureRole{sec/2}{Sect} |
| 295 |
\NewStructureName{sec/2/title} |
| 296 |
\AssignStructureRole{sec/2/title}{subsection} |
| 297 |
\NewStructureName{sec/2/number} |
| 298 |
\AssignStructureRole{sec/2/number}{section-number} |
| 299 |
\NewStructureName{sec/3} |
| 300 |
\AssignStructureRole{sec/3}{Sect} |
| 301 |
\NewStructureName{sec/3/title} |
| 302 |
\AssignStructureRole{sec/3/title}{subsubsection} |
| 303 |
\NewStructureName{sec/3/number} |
| 304 |
\AssignStructureRole{sec/3/number}{section-number} |
| 305 |
\NewStructureName{sec/4} |
| 306 |
\AssignStructureRole{sec/4}{Sect} |
| 307 |
\NewStructureName{sec/4/title} |
| 308 |
\AssignStructureRole{sec/4/title}{paragraph} |
| 309 |
\NewStructureName{sec/4/number} |
| 310 |
\AssignStructureRole{sec/4/number}{section-number} |
| 311 |
\NewStructureName{sec/5} |
| 312 |
\AssignStructureRole{sec/5}{Sect} |
| 313 |
\NewStructureName{sec/5/title} |
| 314 |
\AssignStructureRole{sec/5/title}{subparagraph} |
| 315 |
\NewStructureName{sec/5/number} |
| 316 |
\AssignStructureRole{sec/5/number}{section-number} |
| 317 |
% \end{macrocode} |
| 318 |
% |
| 319 |
% \subsubsection{Table of contents and similar} |
| 320 |
% \begin{macrocode} |
| 321 |
\NewStructureName{toc} |
| 322 |
\AssignStructureRole{toc}{TOC} |
| 323 |
\NewStructureName{toc/item} |
| 324 |
\AssignStructureRole{toc/item}{TOCI} |
| 325 |
\NewStructureName{toc/item/label} |
| 326 |
\AssignStructureRole{toc/item/label}{Lbl} |
| 327 |
\NewStructureName{toc/item/text} |
| 328 |
\AssignStructureRole{toc/item/text}{Reference} |
| 329 |
\NewStructureName{toc/item/page} |
| 330 |
\AssignStructureRole{toc/item/page}{Reference} |
| 331 |
% \end{macrocode} |
| 332 |
% |
| 333 |
% \subsubsection{Title} |
| 334 |
% \enquote{title} in this context can be a structure that surrounds the \emph{title block} (or a part from it) |
| 335 |
% with author, title, subtitle, date and perhaps more. Or it can mean only the \emph{title text} (plus perhaps |
| 336 |
% the subtitle). |
| 337 |
% In PDF 2.0 the tag \texttt{Title} is described as grouping and block type and it can not be used |
| 338 |
% in a \texttt{P} tag, so it is better used for the \emph{title block}. |
| 339 |
% With PDF 1.7 \texttt{Title} is currently rolemapped to \texttt{P} and |
| 340 |
% the code in latex-lab-title uses it for the \emph{title text}. |
| 341 |
% \ufi{This should be discussed.} |
| 342 |
% We provide therefore two symbolic names for the two concepts, which both map to \texttt{Title}. |
| 343 |
% \begin{macrocode} |
| 344 |
\NewStructureName{title/block} |
| 345 |
\AssignStructureRole{title/block}{Title} |
| 346 |
\NewStructureName{title/text} |
| 347 |
\AssignStructureRole{title/text}{Title} |
| 348 |
% \end{macrocode} |
| 349 |
% |
| 350 |
% \subsubsection{Lists and blocks} |
| 351 |
% \texttt{block/inner} is the generic named used for inner blocks |
| 352 |
% in, e.g., the recipe \texttt{standard}. |
| 353 |
% \begin{macrocode} |
| 354 |
\NewStructureName{block/inner} |
| 355 |
\AssignStructureRole{block/inner}{Div} |
| 356 |
\NewStructureName{block/itemize} |
| 357 |
\AssignStructureRole{block/itemize}{itemize} |
| 358 |
\NewStructureName{block/description} |
| 359 |
\AssignStructureRole{block/description}{description} |
| 360 |
\NewStructureName{block/enumerate} |
| 361 |
\AssignStructureRole{block/enumerate}{enumerate} |
| 362 |
\NewStructureName{block/list} |
| 363 |
\AssignStructureRole{block/list}{list} |
| 364 |
\NewStructureName{block/list/item} |
| 365 |
\AssignStructureRole{block/list/item}{item} |
| 366 |
\NewStructureName{block/list/label} |
| 367 |
\AssignStructureRole{block/list/label}{itemlabel} |
| 368 |
\NewStructureName{block/list/body} |
| 369 |
\AssignStructureRole{block/list/body}{itembody} |
| 370 |
% \end{macrocode} |
| 371 |
% |
| 372 |
% \begin{macrocode} |
| 373 |
\NewStructureName{block/quote} |
| 374 |
\AssignStructureRole{block/quote}{quote} |
| 375 |
% \end{macrocode} |
| 376 |
% |
| 377 |
% For now we map \texttt{verse} to \texttt{quote} which means |
| 378 |
% it will become BlockQuote in tagging.\fmi{decide on tagging |
| 379 |
% for verse} |
| 380 |
% \begin{macrocode} |
| 381 |
\NewStructureName{block/verse} |
| 382 |
\AssignStructureRole{block/verse}{quote} |
| 383 |
% \end{macrocode} |
| 384 |
% |
| 385 |
% \begin{macrocode} |
| 386 |
\NewStructureName{block/quotation} |
| 387 |
\AssignStructureRole{block/quotation}{quotation} |
| 388 |
% |
| 389 |
\NewStructureName{block/verbatim} |
| 390 |
\AssignStructureRole{block/verbatim}{verbatim} |
| 391 |
\NewStructureName{block/verbatim/codeline} |
| 392 |
\AssignStructureRole{block/verbatim/codeline}{codeline} |
| 393 |
\NewStructureName{block/verbatim/linenumber} |
| 394 |
\AssignStructureRole{block/verbatim/linenumber}{Lbl} |
| 395 |
% |
| 396 |
\NewStructureName{block/theorem-like} |
| 397 |
\AssignStructureRole{block/theorem-like}{theorem-like} |
| 398 |
\NewStructureName{block/theorem-like/caption} |
| 399 |
\AssignStructureRole{block/theorem-like/caption}{Caption} |
| 400 |
\NewStructureName{block/theorem-like/label} |
| 401 |
\AssignStructureRole{block/theorem-like/label}{Lbl} |
| 402 |
% \end{macrocode} |
| 403 |
% For now we map proof to theorem-like: |
| 404 |
% \begin{macrocode} |
| 405 |
\NewStructureName{block/proof} |
| 406 |
\AssignStructureRole{block/proof}{theorem-like} |
| 407 |
% \end{macrocode} |
| 408 |
% |
| 409 |
% Bibliographies normally use internally lists and tag names should be adapted |
| 410 |
% by changing the symbolic names of lists locally, so dedicated symbolic names |
| 411 |
% are probably not needed. |
| 412 |
% \begin{macrocode} |
| 413 |
%\NewStructureName{block/bib} |
| 414 |
%\AssignStructureRole{block/bib}{L} |
| 415 |
%\NewStructureName{block/bib/label} |
| 416 |
%\AssignStructureRole{block/bib/label}{Lbl} |
| 417 |
%\NewStructureName{block/bib/item} |
| 418 |
%\AssignStructureRole{block/bib/item}{LI} |
| 419 |
%\NewStructureName{block/bib/body} |
| 420 |
%\AssignStructureRole{block/bib/body}{LBody} |
| 421 |
% \end{macrocode} |
| 422 |
% |
| 423 |
%\subsubsection{\LaTeX{} Code documentation} |
| 424 |
% The class l3doc defines a number of structures for the document of \LaTeX\ code. |
| 425 |
% The exact tagging is currently experimental and it is unclear if |
| 426 |
% symbolic names and tag names for this case should be setup here by default. |
| 427 |
% Their setup is therefore done in latex-lab-l3doc-tagging. |
| 428 |
% |
| 429 |
% |
| 430 |
%\subsubsection{References and Links} |
| 431 |
% |
| 432 |
% \begin{macrocode} |
| 433 |
\NewStructureName{ref} |
| 434 |
\AssignStructureRole{ref}{Reference} |
| 435 |
\NewStructureName{link} |
| 436 |
\AssignStructureRole{link}{Link} |
| 437 |
\NewStructureName{cite} |
| 438 |
\AssignStructureRole{cite}{Reference} |
| 439 |
% \end{macrocode} |
| 440 |
% |
| 441 |
% \subsubsection{Tables} |
| 442 |
% |
| 443 |
% \begin{macrocode} |
| 444 |
\NewStructureName{table} |
| 445 |
\AssignStructureRole{table}{Table} |
| 446 |
\NewStructureName{table/row} |
| 447 |
\AssignStructureRole{table/row}{TR} |
| 448 |
\NewStructureName{table/cell} |
| 449 |
\AssignStructureRole{table/cell}{TD} |
| 450 |
\NewStructureName{table/headercell} |
| 451 |
\AssignStructureRole{table/headercell}{TH} |
| 452 |
% \end{macrocode} |
| 453 |
% THead and TFoot are currently not used but are perhaps needed later |
| 454 |
% \begin{macrocode} |
| 455 |
%\NewStructureName{tbl/table/head} |
| 456 |
%\AssignStructureRole{tbl/table/head}{} |
| 457 |
%\NewStructureName{tbl/table/foot} |
| 458 |
%\AssignStructureRole{tbl/table/foot}{} |
| 459 |
% \end{macrocode} |
| 460 |
% Inside p-cells we have to set the para/semantic structure to Div as Part is not |
| 461 |
% allowed as child of TD and as we can not flatten the paragraphs. |
| 462 |
% \begin{macrocode} |
| 463 |
\NewStructureName{table/para/semantic} |
| 464 |
\AssignStructureRole{table/para/semantic}{Div} |
| 465 |
% \end{macrocode} |
| 466 |
% We need also names for layout tables |
| 467 |
% \begin{macrocode} |
| 468 |
\NewStructureName{layouttable} |
| 469 |
\AssignStructureRole{layouttable}{Div} |
| 470 |
\NewStructureName{layouttable/row} |
| 471 |
\AssignStructureRole{layouttable/row}{NonStruct} |
| 472 |
\NewStructureName{layouttable/cell} |
| 473 |
\AssignStructureRole{layouttable/cell}{\UseStructureName{para/textblock}} |
| 474 |
\NewStructureName{layouttable/pcell} |
| 475 |
\AssignStructureRole{layouttable/pcell}{NonStruct} |
| 476 |
% \end{macrocode} |
| 477 |
% |
| 478 |
% |
| 479 |
% |
| 480 |
% \subsubsection{Floats} |
| 481 |
% |
| 482 |
% \begin{macrocode} |
| 483 |
\NewStructureName{float/generic} |
| 484 |
\AssignStructureRole{float/generic}{float} |
| 485 |
\NewStructureName{float/figures} |
| 486 |
\AssignStructureRole{float/figures}{figures} |
| 487 |
\NewStructureName{float/tables} |
| 488 |
\AssignStructureRole{float/tables}{tables} |
| 489 |
\NewStructureName{float/figure} |
| 490 |
\AssignStructureRole{float/figure}{float} |
| 491 |
\NewStructureName{float/table} |
| 492 |
\AssignStructureRole{float/table}{float} |
| 493 |
\NewStructureName{float/figure/caption} |
| 494 |
\AssignStructureRole{float/figure/caption}{Caption} |
| 495 |
\NewStructureName{float/table/caption} |
| 496 |
\AssignStructureRole{float/table/caption}{Caption} |
| 497 |
\NewStructureName{float/figure/label} |
| 498 |
\AssignStructureRole{float/figure/label}{Lbl} |
| 499 |
\NewStructureName{float/table/label} |
| 500 |
\AssignStructureRole{float/table/label}{Lbl} |
| 501 |
% \end{macrocode} |
| 502 |
% |
| 503 |
% \subsubsection{Footnotes} |
| 504 |
% |
| 505 |
% \begin{macrocode} |
| 506 |
\NewStructureName{fnote/mark} |
| 507 |
\AssignStructureRole{fnote/mark}{footnotemark} |
| 508 |
\NewStructureName{fnote/note} |
| 509 |
\AssignStructureRole{fnote/note}{footnote} |
| 510 |
\NewStructureName{fnote/note/label} |
| 511 |
\AssignStructureRole{fnote/note/label}{footnotelabel} |
| 512 |
% \end{macrocode} |
| 513 |
% |
| 514 |
% \subsubsection{Graphics} |
| 515 |
% \begin{macrocode} |
| 516 |
\NewStructureName{graphic} |
| 517 |
\AssignStructureRole{graphic}{Figure} |
| 518 |
\NewStructureName{graphic/symbol} |
| 519 |
\AssignStructureRole{graphic/symbol}{Span} |
| 520 |
% \end{macrocode} |
| 521 |
% |
| 522 |
% \subsubsection{Marginnotes} |
| 523 |
% \begin{macrocode} |
| 524 |
\NewStructureName{marginnote} |
| 525 |
\AssignStructureRole{marginnote}{Aside} |
| 526 |
% \end{macrocode} |
| 527 |
% |
| 528 |
% \subsubsection{Minipages and parboxes} |
| 529 |
% \begin{macrocode} |
| 530 |
\NewStructureName{minipage} |
| 531 |
\AssignStructureRole{minipage}{Div} |
| 532 |
\NewStructureName{parbox} |
| 533 |
\AssignStructureRole{parbox}{Div} |
| 534 |
% \end{macrocode} |
| 535 |
% |
| 536 |
% \subsubsection{Text} |
| 537 |
% \begin{macrocode} |
| 538 |
\NewStructureName{text/emph} |
| 539 |
\AssignStructureRole{text/emph}{Em} |
| 540 |
\NewStructureName{text/verb} |
| 541 |
\AssignStructureRole{text/verb}{Code} |
| 542 |
% \end{macrocode} |
| 543 |
% |
| 544 |
% \subsubsection{Math} |
| 545 |
% Math uses internally MathML and this should not be remapped so we need only |
| 546 |
% names for the outer \texttt{Formula} tag and perhaps for a label: |
| 547 |
% \begin{macrocode} |
| 548 |
\NewStructureName{math/inline} |
| 549 |
\AssignStructureRole{math/inline}{Formula} |
| 550 |
\NewStructureName{math/display} |
| 551 |
\AssignStructureRole{math/display}{Formula} |
| 552 |
\NewStructureName{math/label} |
| 553 |
\AssignStructureRole{math/label}{Lbl} |
| 554 |
% \end{macrocode} |
| 555 |
% |
| 556 |
% \subsubsection{Index and glossaries} |
| 557 |
% Tagging not decided yet. |
| 558 |
% |
| 559 |
% \subsection{Attributes} |
| 560 |
% \changes{v0.8j}{2026-04-27}{Add kernel attributes} |
| 561 |
% \changes{v0.8k}{2026-04-28}{Add more kernel attributes} |
| 562 |
% The latex-lab code sets up a number of kernel attributes. These are collected here: |
| 563 |
% \begin{macrocode} |
| 564 |
\tagpdfsetup |
| 565 |
{ |
| 566 |
% \end{macrocode} |
| 567 |
% \subsection{Text attributes} |
| 568 |
% These attributes are for super- and subscripts and are used in latex-lab-text: |
| 569 |
% \begin{macrocode} |
| 570 |
role/new-attribute = {sub} {/O /Layout /TextPosition/Sub}, |
| 571 |
role/new-attribute = {sup} {/O /Layout /TextPosition/Sup}, |
| 572 |
% \end{macrocode} |
| 573 |
% These are for text alignment and they are used in latex-lab-block: |
| 574 |
role/new-attribute = {justify} {/O /Layout /TextAlign/Justify}, |
| 575 |
role/new-attribute = {center} {/O /Layout /TextAlign/Center}, |
| 576 |
role/new-attribute = {raggedright}{/O /Layout /TextAlign/Start}, |
| 577 |
role/new-attribute = {raggedleft} {/O /Layout /TextAlign/End}, |
| 578 |
% \subsection{Math attributes} |
| 579 |
% \begin{macrocode} |
| 580 |
role/new-attribute = {inline} {/O /Layout /Placement/Inline}, |
| 581 |
role/new-attribute = {display} {/O /Layout /Placement/Block}, |
| 582 |
% \end{macrocode} |
| 583 |
% \subsection{List attributes} |
| 584 |
% \begin{macrocode} |
| 585 |
role/new-attribute = {itemize} |
| 586 |
{/O /List /ListNumbering/Unordered}, |
| 587 |
role/new-attribute = {enumerate} |
| 588 |
{/O /List /ListNumbering/Ordered}, |
| 589 |
role/new-attribute = {description} |
| 590 |
{/O /List /ListNumbering/Description}, |
| 591 |
% \end{macrocode} |
| 592 |
% Initially, we had \texttt{/None} for the basic \env{list} |
| 593 |
% environment, but that is not allowed in PDF/UA-2 if the list |
| 594 |
% contains any Lbl tags. So the \texttt{list} attribute uses |
| 595 |
% \texttt{Unordered} too. |
| 596 |
% \begin{macrocode} |
| 597 |
role/new-attribute = {list}{/O /List /ListNumbering/Unordered}, |
| 598 |
% \end{macrocode} |
| 599 |
% \subsection{Table attributes} |
| 600 |
% The code predeclares three attribute names for the scope of header, |
| 601 |
% \texttt{TH-col}, \texttt{TH-row}, \texttt{TH-both}. |
| 602 |
% The latex-lab-table code declares on the fly additional attributes |
| 603 |
% \texttt{colspan-\meta{number}} and \texttt{rowspan-\meta{number}} |
| 604 |
% with the content \texttt{/O /Table /ColSpan \meta{number}} and |
| 605 |
% \texttt{/O /Table /RowSpan \meta{number}} |
| 606 |
% \begin{macrocode} |
| 607 |
role/new-attribute = {TH-col} {/O /Table /Scope /Column}, |
| 608 |
role/new-attribute = {TH-row} {/O /Table /Scope /Row}, |
| 609 |
role/new-attribute = {TH-both} {/O /Table /Scope /Both}, |
| 610 |
role/new-attribute = {ARIA-role-presentation} |
| 611 |
{/O /ARIA-1.1/role (presentation)} |
| 612 |
% \end{macrocode} |
| 613 |
% \begin{macrocode} |
| 614 |
} %end tagpdfsetup |
| 615 |
% \end{macrocode} |
| 616 |
% The three main table attributes are put directly into the class map |
| 617 |
% TODO: either tagpdf should do that directly all roles or offer an interface: |
| 618 |
% \begin{macrocode} |
| 619 |
\ExplSyntaxOn |
| 620 |
\seq_gput_left:Ne\g__tag_attr_class_used_seq |
| 621 |
{\pdf_name_from_unicode_e:n{TH-col}} |
| 622 |
\seq_gput_left:Ne\g__tag_attr_class_used_seq |
| 623 |
{\pdf_name_from_unicode_e:n{TH-row}} |
| 624 |
\seq_gput_left:Ne\g__tag_attr_class_used_seq |
| 625 |
{\pdf_name_from_unicode_e:n{TH-both}} |
| 626 |
\ExplSyntaxOff |
| 627 |
% \end{macrocode} |
| 628 |
% \begin{macrocode} |
| 629 |
%</package> |
| 630 |
% \end{macrocode} |
| 631 |
% \end{implementation} |
| 632 |
\endinput |