blob: d6485c86fe58d1ad4605104d076a06728e3b0691 (
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
87
88
89
90
91
92
93
94
95
96
|
% !Mode:: "TeX:DE:UTF-8:Main"
%This example shows how one can patch lists command
%it is based on enumitem
%It uses a command to end \item (\meti). It is perhaps possible to hide this command
% inside \item/end{list}, but with nested list it is not so easy.
% not really up-to-date, with paratagging one could simplify things.
% Pay attention to casing. Li/LI, Lbody/Lbody are different.
%no page break involved. So the example works in lua and generic mode
\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{pdfversion=1.7,uncompress}
\documentclass{scrbook}
\usepackage[english]{babel}
\usepackage{tagpdf}
\usepackage{iftex}
\iftutex
\usepackage{fontspec}
\usepackage{luacode}
\else
\usepackage[T1]{fontenc}
\fi
\tagpdfsetup{tabsorder=structure,
activate,
}
\usepackage{lipsum}%\textheight3cm
\usepackage{enumitem,xpatch}
\makeatletter
\newcommand\tag@enit@format@preset[1]{%
\tagstructbegin{tag=LI}%
\tagstructbegin{tag=Lbl}%
\tagmcbegin{tag=Lbl}%
#1%
\tagmcend
\tagstructend %end Lbl
\tagstructbegin{tag=LBody}}
\newcommand\meti{% end of \item
\tagstructend %end of LBody
\tagstructend %end of LI
}
\xpatchcmd\enit@preset{\@firstofone}{\tag@enit@format@preset}{}{\fail}
\setlist{
before*=\tagstructbegin{tag=L},
after*={\tagstructend}}
% keys that overwrite \enit@format must be patched, eg like the follow
% the font key should be patched in a similar way
\enitkv@key{enumitem}{format}{%
\def\enit@format{%
\tagstructbegin{tag=LI}%
\tagstructbegin{tag=Lbl}%
\tagmcbegin{tag=Lbl}%
#1\tagmcend}}
\makeatother
% marking of the text inside the list can not be handled automatically -- one doesn't know the type
% we use simple P here
\newcommand\TAGP{\tagstructbegin{tag=P}\tagmcbegin{tag=P}}
\newcommand\PGAT{\tagmcend\tagstructend}
\begin{document}
%I don't want to handle pagestyles, so set everything to empty:
\pagestyle{empty}\renewcommand\chapterpagestyle{empty}
\begin{itemize}
\item \TAGP Ducks say quack\PGAT\meti
\item \TAGP Marmots say something Parmotlike\PGAT\meti
\end{itemize}
\begin{enumerate}
\item \TAGP The highest pass is the Col de l'Iseran.\PGAT\meti
\item \TAGP The second highest pass is the Passo dello Stelvio.\PGAT\meti
\end{enumerate}
\begin{description}
\item[ducks] \TAGP yellow\PGAT\meti
\item[marmots] \TAGP brown\PGAT\meti
\end{description}
\end{document}
|