我有一个代码,可以自动标记 \maketitle 命令的所有字段。此代码通过 \prop_function 进行迭代,但我想通过 prop_map_inline 进行迭代,以减少代码量,但我收到错误:您不能使用带有“字符 @”的前缀。感谢大家的帮助。
\documentclass{article}
\usepackage{tagpdf}
\tagpdfsetup{tabsorder=structure,uncompress,activate-all,add-new-tag=Title/P,interwordspace=true,tagunmarked=false,log/all}
\pagestyle{empty}
\ExplSyntaxOn
\prop_set_from_keyval:Nn \l__kozlovskiy_data_of_title_prop
{
@author = H1 ,
@date = H1 ,
@thanks = H1 ,
@title = H1 ,
}
\DeclareRobustCommand\thanks[1]{\footnotemark
\protected@xdef\orig@@thanks{\orig@@thanks
\protect\footnotetext[\the\c@footnote]{#1}}}
\makeatother
\cs_new_protected:Npn \kozlovskiy_maketitle:
{
\tagstructbegin{tag=Title}
\prop_map_inline:Nn \l__kozlovskiy_data_of_title_prop{
\cs_gset_eq:cc { orig@##1 } { ##1 }
\cs_gset_protected:cpn { ##1 }
{
\tagstructbegin{tag=##2}
\tagmcbegin{tag=##2}
\use:c { orig@##1 }
\tagmcend
\tagstructend
}
}
\__kozlovskiy_original_maketitle:
\tagstructend
}
\cs_new_eq:NN \__kozlovskiy_original_maketitle: \maketitle
\cs_gset_protected:Npn \maketitle { \kozlovskiy_maketitle: }
\ExplSyntaxOff
%
\author{alexandr Kozlovskiy}
\date{\today}
\title{test document%
\thanks{Alexandr Kozlovskiy}
}
\begin{document}
\tagstructbegin{tag=Document}
\maketitle
\tagstructbegin{tag=P}
\tagmcbegin{tag=P}
Test
\tagmcend
\tagstructend
\tagstructend
\end{document}