
이 질문은 이전 질문과 연결되어 있으므로 이에 대한 새 질문을 만들고 싶었습니다. 여러 환경에 태그를 지정하기 위해 속성을 사용하기로 결정했습니다. 하지만 \tabular를 사용하는 \maketitle의 경우 오류가 발생합니다.
! LaTeX 오류: 배열 arg에 잘못된 문자가 있습니다.
이 문제를 해결하도록 도와주세요. (이제 우리가 가지고 있는 PDF가 무엇인지는 중요하지 않습니다. 왜냐하면 우리 패키지에는 이에 대한 더 많은 코드가 있기 때문입니다. 문제를 보여주기 위해 코드를 줄였습니다.) 도움을 주신 모든 분들께 감사드립니다.
\documentclass{article}
\usepackage{tagpdf}
\tagpdfsetup{tabsorder=structure,uncompress,activate-all,add-new-tag=Title/P,interwordspace=true}
\ExplSyntaxOn
\makeatletter
\prop_gset_from_keyval:Nn{\g__tables_prop}{table=0,endtable=1,table*=0,endtable*=1,tabular=0,endtabular=1,tabular*=0,endtabular*=1,tabbing=0,endtabbing=1,tabbing*=0,endtabbing*=1}
\prop_map_inline:Nn \g__tables_prop{
\cs_set_eq:cc{orig@#1}{#1}
\cs_gset_protected:cpn{#1}##1{
\int_case:nnF{#2}
{
{0} %somethin with \begin,e.g \begin{tabular}
{
\cs_new_protected:Npn \l__tab_char: {
\tagmcend
\tagstructend
\tagstructend
\tagstructbegin{tag=TD}
\tagstructbegin{tag=P}
\tagmcbegin{tag=P}
\c_alignment_token
}
\char_set_active_eq:NN \& \l__tab_char:
\char_set_catcode_active:N \&
\tagstructbegin{tag=Table}
\tagstructbegin{tag=TBody}
\use:c{orig@#1}{##1}
\message{argument~##1}
}
{1} %somethin with \end,e.g \end{tabular}
{
\use:c{orig@#1}{##1}
\tagstructend
\tagstructend
}
}
{}
}
}
\makeatother
\ExplSyntaxOff
\author{Alexandr Kozlovskiy}
\title{test}
\begin{document}
\tagstructbegin{tag=Document}
\maketitle{} %error
\makeatletter
%this code works ok.
\begin{tabular}{ccc}
1&2&3
\end{tabular}
\tagstructend
\end{document}
답변1
나는 당신이 찾고있는 것이 아마도 패키지 \pretocmd
에서 나온 것이라고 생각합니다 etoolbox
. 또한 LaTeX 코딩과 들여쓰기가 약간 엉성합니다. 도움이 되셨다면 제가 글을 작성해 놓았습니다.지도 시간LaTeX3에서.
\documentclass{article}
\usepackage{tagpdf}
\usepackage{etoolbox}
\tagpdfsetup{tabsorder=structure,
uncompress,
activate-all,
add-new-tag=Title/P,
interwordspace=true
}
\makeatletter
\ExplSyntaxOn
\clist_new:N \g_tab_env_clist
\clist_gset:Nn \g_tab_env_clist {
table,
table*,
tabular,
tabular*,
%tabbing,
%tabbing*
}
\cs_set_eq:NN \pre_to_cmd:Nnnn \pretocmd
\cs_generate_variant:Nn \pre_to_cmd:Nnnn {cnnn}
\clist_map_inline:Nn \g_tab_env_clist {
\pre_to_cmd:cnnn {#1} {
\char_set_active_eq:NN \& \g__tab_char:
\char_set_catcode_active:N \&
\tagstructbegin{tag=Table}
\tagstructbegin{tag=TBody}
}{}{
\GenericError {}{unable~to~patch~command~"#1"}{}{}
}
\pre_to_cmd:cnnn {end#1} {
\tagstructend
\tagstructend
}{}{
\GenericError {}{unable~to~patch~command~"end#1"}{}{}
}
}
\cs_set_protected:Npn \g__tab_char: {
\tagmcend
\tagstructend
\tagstructend
\tagstructbegin{tag=TD}
\tagstructbegin{tag=P}
\tagmcbegin{tag=P}
\c_alignment_token
}
\ExplSyntaxOff
\makeatother
\author{Alexandr Kozlovskiy}
\title{test}
\begin{document}
\tagstructbegin{tag=Document}
\maketitle{}
\begin{tabular}{ccc}
1&2&3
\end{tabular}
\tagstructend
\end{document}