![重新定义标记 PDF 的列表环境](https://linux22.com/image/452902/%E9%87%8D%E6%96%B0%E5%AE%9A%E4%B9%89%E6%A0%87%E8%AE%B0%20PDF%20%E7%9A%84%E5%88%97%E8%A1%A8%E7%8E%AF%E5%A2%83.png)
我正在尝试重新定义列表环境,用于自动标记结构,而不是在 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}