自动标记分页符有多正确

自动标记分页符有多正确

在我们的包中,我想处理分页符,以使用 genericnode 中的 tagpdf 包。为此,我想重新定义 \tagncbegin/\tagncend 命令,以保存标记的最后参数。为此,我将这些参数保存在 tallest 中,但当我重新定义 \naketitle 命令时,我收到错误:

\无法访问 l.73 \maketitle

另外,我在将 tlist 转换为键时遇到了问题,因为根据文档,在 l3keys 中,参数被视为字符串,因此参数中的变量名称将被视为字符串值,而不是变量名称,变量名称应该被扩展。请帮我解决这个问题。非常感谢大家的帮助(我使用 GitHub 上最新分支中最新版本的 tagpdf 和 pdfresources 包,对于行分隔符我深表歉意,因为我现在从我的 Mac 上修改并撰写了我的帖子)。

\RequirePackage[patches]{pdfresources}
\DeclareDocumentMetadata{pdfversion=2.0}
\documentclass{article}
\usepackage{tagpdf}
\tagpdfsetup{tabsorder=structure,uncompress,activate-all,add-new-tag=Title/P,interwordspace=true}
\ExplSyntaxOn
\makeatletter
  \tl_new:N \g__last_mc_tl %last opened mc tag with all params
  \bool_new:N \g__inside_new_page_command_bool
\let\orig@tagmcbegin=\tagmcbegin
  \let\orig@tagmcend=\tagmcend
\let\orig@newpage=\newpage
\renewcommand{\tagmcbegin}[1]{
\tl_gset:Nn  \g__last_mc_tl{#1}
\orig@tagmcbegin{#1}
}
\renewcommand{\tagmcend}{
\orig@tagmcend
\bool_if:NTF \g__inside_new_page_command_bool{}{\tl_gclear:N \g__last_mc_tl}
}
  \renewcommand{\newpage}{
  \tl_if_empty:NTF \g__last_mc_tl{
  \orig@newpage
}{
\bool_gset_true:N \g__inside_new_page_command_bool
\tagmcend
\bool_gset_false:N \g__inside_new_page_command_bool
\orig@newpage
\tagmcbegin{\g__last_mc_tl}
}}
%tagging of title

\prop_set_from_keyval:Nn \l__kozlovskiy_data_of_title_prop
  {
    @author = H1 ,
    @date   = H1 ,
    @title  = H1 ,
  }
\DeclareRobustCommand\thanks[1]{\footnotemark
    \protected@xdef\@thanks{\@thanks
        \protect\footnotetext[\the\c@footnote]{\tagstructbegin{tag=H1}\tagmcbegin{tag=H1}#1\tagmcend\tagstructend}}
}
\cs_new_protected:Npn \kozlovskiy_maketitle:
  {
    \tagstructbegin{tag=Title}
\prop_map_inline:Nn \l__kozlovskiy_data_of_title_prop{
\cs_set_eq:cc { orig@##1 } { ##1 }
\bool_if:nTF{\tl_if_empty_p:N {##1}}
{
\use:c { orig@##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: }
\makeatother
\ExplSyntaxOff
\begin{document}
\tagstructbegin{tag=Document}
\author{Alexandr Kozlovskiy}
\title{test \thanks{Alexandr Kozlovskiy}}
\maketitle{}
\tagstructbegin{tag=P}
\tagmcbegin{tag=P}
Test
\newpage
test again
\tagmcend
\tagstructend
\tagstructend
\end{document}

相关内容