Please,help me,how i can correct do tagging of the tables. I try to do it,but i get an error:
! LaTeX Error: Illegal character in array arg.
I guessed,what this error happens because to the \tabular command i give nothing as argument. I tryed give one,two,three and four arguments,but this error is not disappear. Using \message command i noticed,what each argument,which i give to command,using \cs_gset_protected:cpn{tabular}#1 #2 #3 #4{\some_code} gives to command tabular for each argument only one character. for example for \tabular{ccc} i have things like { c c c for each argument. Help me please fix this error. Also help me please,what command should i use for table,tabbing and any other table environment,for each line and cell. I will do tagging of this environments myself,if i will know this commands. Thank you very much for your help with fixing of error and with commands for table environments.
\documentclass{article}
\usepackage{tagpdf}
\tagpdfsetup{tabsorder=structure,uncompress,activate-all,add-new-tag=Title/P,interwordspace=true}
\ExplSyntaxOn
\makeatletter
\cs_set_eq:cc{orig@tabular}{tabular}
\cs_set_eq:cc{orig@endtabular}{endtabular}
\cs_gset_protected:cpn{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@tabular}
\let\orig@startfield=\@startfield
\let\orig@stopfield=\@stopfield
\let\orig@startline=\@startline
\let\orig@stopline=\@stopline
\renewcommand{\@startfield}{
\tagstructbegin{tag=TD}
\tagstructbegin{tag=P}
\tagmcbegin{tag=P}
\orig@startfield
}
\renewcommand{\@stopfield}{
\orig@stopfield
\tagmcend
\tagstructend
\tagstructend
}
\renewcommand{\@startline}{
\tagstructbegin{tag=TR}
\tagstructbegin{tag=TD}
\tagstructbegin{tag=P}
\tagmcbegin{tag=P}
\orig@startline
}
\renewcommand{\@stopline}{
\orig@stopline
\tagmcend
\tagstructend
\tagstructend
\tagstructend
}
}
\cs_gset_protected:cpn{endtabular}{
\use:c{orig@endtabular}
\tagstructend
\tagstructend
}
\makeatother
\ExplSyntaxOff
\begin{document}
\tagstructbegin{tag=Document}
\begin{tabular}{cc}
a&b
c&d
\end{tabular}
\tagstructend
\end{document}
\use:c
here.\use:c{orig@tabular}\let
is just an inefficient equivalent to\orig@tabular\let
so the argument to tabular is\let
not{ccc}
hence the error. You need\orig@tabular
to be the very last thing in the redefinition, so it picks up the argument from the document.tabular
and are internal commands for thetabbing
environment.