[luatex] How to correct expand user commands in lualatex?
Alexandr Kozlovskiy
k.sasha1994 at yandex.ru
Tue Jan 28 20:49:31 CET 2020
Hello everybody. I try to redefine equation environment,to insert
actualtext of formula. But if i insert the space after equation,and use
\expanded command,to correct expand commands,i get for arguments 1,1
actualtext
1*1=\protect {\Ustack {\group_begin: 1\group_end: \@@over 1}}
instead of actualtext like
1*1=\frac{1}{1}.
Help me please,how correct expand user commands,to insert correct
actualtext to formula.In attachment you will see an example,which not
works for me. Thank you very much for any help.
-------------- next part --------------
\documentclass{article}
\usepackage{amsmath,amssymb,tagpdf,unicode-math}
\ExplSyntaxOn
\tagpdfsetup{tabsorder=structure,uncompress,activate-all,interwordspace=true}
\protected\def\DoTaggedEquation#1{
\tagstructbegin{tag=P,actualtext-o=\detokenize\expandafter{\expanded{#1}}}
\tagmcbegin{tag=P}
#1
\tagmcend
\tagstructend
}
\makeatletter
\renewenvironment{equation}{
\incr at eqnum
\mathdisplay at push
\st at rredfalse \global\@eqnswtrue
\mathdisplay{equation}%
\collect at body\DoTaggedEquation\c_space_tl}{
\endmathdisplay{equation}%
\mathdisplay at pop
\ignorespacesafterend
}
\makeatletter
\newcommand{\test}[2]{#1*#2=\frac{#1}{#2}}
\ExplSyntaxOff
\begin{document}
\tagstructbegin{tag={Document}}
\begin{equation}\test{2}{2}\end{equation}
\tagstructend
\end{document}
More information about the luatex
mailing list.