![如何标记列表中的项目,但不标记列表本身?](https://linux22.com/image/471631/%E5%A6%82%E4%BD%95%E6%A0%87%E8%AE%B0%E5%88%97%E8%A1%A8%E4%B8%AD%E7%9A%84%E9%A1%B9%E7%9B%AE%EF%BC%8C%E4%BD%86%E4%B8%8D%E6%A0%87%E8%AE%B0%E5%88%97%E8%A1%A8%E6%9C%AC%E8%BA%AB%EF%BC%9F.png)
我想标记列表中的元素(标签和文本),但使标记的 PDF 的结构表现得好像列表本身不存在一样。
无论有没有列表环境,具体用例都必须能够工作,而且这些结构元素旨在作为其他元素的子元素插入。因此,我们的想法是将列表抽象出来,只标记感兴趣的内容。
但是,我似乎无法将我想要的标记与列表环境的默认标记区分开来。
具有以下情况的 MWE(包括一些说明我想要实现的目标的伪代码):
\DocumentMetadata
{
testphase=phase-III,
pdfversion=2.0,
uncompress,
}
\tagpdfsetup
{
add-new-tag = { tag=mynote, role=FENote } ,
add-new-tag = { tag=mylabel, role=Lbl } ,
}
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\begin{description}
\item[label1] Text first item
\item[label2] Text second item
\end{description}
% What I'd like to do is something like the following. Which, of course,
% doesn't work. Consider it as pseudo code...
% \tagstop
% \begin{description}
% \item[
% \tagstart
% \tagstructbegin{tag=mynote}
% \tagstructbegin{tag=mylabel}
% \tagmcbegin{}
% label1
% \tagmcend
% \tagstructend % mylabel
% \tagstop
% ]
% \tagstart
% \tagstructbegin{tag=text-unit}
% \tagstructbegin{tag=text}
% \tagmcbegin{}
% Text first item
% \tagmcend
% \tagstructend % text-unit
% \tagstructend % text
% \tagstructend % mynote
% \tagstop
% \item[
% \tagstart
% \tagstructbegin{tag=mynote}
% \tagstructbegin{tag=mylabel}
% \tagmcbegin{}
% label2
% \tagmcend
% \tagstructend % mylabel
% \tagstop
% ]
% \tagstart
% \tagstructbegin{tag=text-unit}
% \tagstructbegin{tag=text}
% \tagmcbegin{}
% Text second item
% \tagmcend
% \tagstructend % text-unit
% \tagstructend % text
% \tagstructend % mynote
% \tagstop
% \end{description}
% \tagstart
\end{document}
这种事情可能吗?
编辑:我得到了一个正常工作的 MWE,它显示了我想要实现的最终结果以及我想要如何实现它。这可以概括为“请让我自己处理此列表的标记”开关(\tagtool{list=false}
?)。MWE 在实践中的问题是它依赖于\relax
来自的大量内部组件latex-lab-testphase-block.sty
。
\DocumentMetadata
{
testphase=phase-III,
pdfversion=2.0,
uncompress,
}
\tagpdfsetup
{
add-new-tag = { tag=mynote, role=FENote } ,
add-new-tag = { tag=mylabel, role=Lbl } ,
}
\documentclass{article}
\usepackage{hyperref}
\ExplSyntaxOn
\AddToHook{env/description/begin}{
\cs_set_eq:NN \__block_list_begin: \prg_do_nothing:
\cs_set_eq:NN \__block_list_end: \prg_do_nothing:
\cs_set_eq:NN \__block_list_item_begin: \prg_do_nothing:
\cs_set_eq:NN \__block_list_item_end: \prg_do_nothing:
\cs_set_eq:NN \__kernel_list_label_begin: \prg_do_nothing:
\cs_set_eq:NN \__kernel_list_label_end: \prg_do_nothing:
}
\ExplSyntaxOff
\begin{document}
\begin{description}
\tagtool{para=false}
\item[
\tagstructbegin{tag=mynote}
\tagstructbegin{tag=mylabel}
\tagmcbegin{}
label1
\tagmcend
\tagstructend % mylabel
]
\tagstructbegin{tag=text-unit}
\tagstructbegin{tag=text}
\leavevmode
\tagtool{para=true}
\tagmcbegin{}
Text first item
\tagmcend
\tagtool{para=false}
\tagstructend % text-unit
\tagstructend % text
\tagstructend % mynote
\item[
\tagstructbegin{tag=mynote}
\tagstructbegin{tag=mylabel}
\tagmcbegin{}
label2
\tagmcend
\tagstructend % mylabel
]
\tagstructbegin{tag=text-unit}
\tagstructbegin{tag=text}
\leavevmode
\tagtool{para=true}
\tagmcbegin{}
Text second item
A paragraph in the second item
\tagmcend
\tagtool{para=false}
\tagstructend % text-unit
\tagstructend % text
\tagstructend % mynote
\end{description}
\end{document}