重新定义标记 PDF 的列表环境

重新定义标记 PDF 的列表环境

我正在尝试重新定义列表环境,用于自动标记结构,而不是在 tex 文件中手动标记

我尝试使用以下编码

\AddToHook{env/enumerate/begin}{\tagstructbegin{tag=L}\tagmcbegin{tag=L}}
\AddToHook{env/enumerate/end}{\tagmcend\tagstructend}
\AddToHook{env/enumerate/itemize}{\tagstructbegin{tag=L}\tagmcbegin{tag=L}}
\AddToHook{env/enumerate/itemize}{\tagmcend\tagstructend}
\AddToHook{env/enumerate/description}{\tagstructbegin{tag=L}\tagmcbegin{tag=L}}
\AddToHook{env/enumerate/description}{\tagmcend\tagstructend}

\NewCommandCopy\olditem\item


\RenewDocumentCommand{\item}{o}
                     {\tagstructbegin{tag=LI}\tagmcbegin{tag=LI}%
                     \tagstructbegin{tag=Lbl}\tagmcbegin{tag=Lbl}%
                     \olditem%
                     \tagmcend\tagstructend%
                     \tagstructbegin{tag=LBody}\tagmcbegin{tag=LBody}
                     }

我获取了错误的标签结构

如何正确关闭\tagmcend \tagstructend和重新打开\tagstructbegin{tag=LI}\tagmcbegin{tag=LI} \tagstructbegin{tag=Lbl}\tagmcbegin{tag=Lbl} \tagstructbegin{tag=Lbl}每个项目

标签LI也不在标签下L,(见下面的截图)

如何对列表结构进行编码以获取正确的标签

在此处输入图片描述

平均能量损失

\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{testphase=phase-II}
\documentclass{book}

\usepackage{tagpdf}
\tagpdfsetup{activate-all}
\usepackage{enumitem}

\AddToHook{env/enumerate/begin}{\tagstructbegin{tag=L}\tagmcbegin{tag=L}}
\AddToHook{env/enumerate/end}{\tagmcend\tagstructend}
\AddToHook{env/enumerate/itemize}{\tagstructbegin{tag=L}\tagmcbegin{tag=L}}
\AddToHook{env/enumerate/itemize}{\tagmcend\tagstructend}
\AddToHook{env/enumerate/description}{\tagstructbegin{tag=L}\tagmcbegin{tag=L}}
\AddToHook{env/enumerate/description}{\tagmcend\tagstructend}

\NewCommandCopy\olditem\item


\RenewDocumentCommand{\item}{o}
                     {\tagstructbegin{tag=LI}\tagmcbegin{tag=LI}%
                     \tagstructbegin{tag=Lbl}\tagmcbegin{tag=Lbl}%
                     \olditem%
                     \tagmcend\tagstructend%
                     \tagstructbegin{tag=LBody}\tagmcbegin{tag=LBody}
                     }



\begin{document}

para text para text para text
\begin{enumerate}
\item `substantially lessen competition' 

\item `every contract, combination'

\item `every person who shall monopolize'  is also coded separately).
\end{enumerate}

para text para text para text
\begin{enumerate}
\item[(a)] `substantially lessen competition' 

 `substantially lessen competition' 

\item[(b)] `every contract, combination'

\item[(c)] `every person who shall monopolize'  is also coded separately).
\end{enumerate}

para text para text para text
\begin{description}
\item  `substantially lessen competition' 

 `substantially lessen competition' 

\item  `every contract, combination'

\item  `every person who shall monopolize'  is also coded separately).
\end{description}
\end{document}

相关内容