0

When i try to insert in command variable with keys,i get an error:

LaTeX3 Error: The key '__tag/mc/\g__last_mc_tl' is unknown and is being (LaTeX3) ignored.

I understand, why this happen. It hapen because according to expl3 documentation,l3keys convert argument as string,so instead of variable,i give variable name. But i haven't any idea,how to fix it. Thanks everybody very much for the help.

\RequirePackage[patches]{pdfresources}
\DeclareDocumentMetadata{pdfversion=2.0}
\documentclass{article}
\usepackage{tagpdf}
\tagpdfsetup{tabsorder=structure,uncompress,activate-all,add-new-tag=Title/P,interwordspace=true}
\begin{document}
\tagstructbegin{tag=Document}
\tagstructbegin{tag=P}
\ExplSyntaxOn
  \tl_new:N \g__mc_tl
\tl_gset:Nn \g__mc_tl{tag=P,actualtext=test of paragraph}
\tagstructbegin{tag=P}
\tagmcbegin{\g__last_mc_tl}
Test
\tagmcend
\tagstructend
\ExplSyntaxOff
\tagstructend
\end{document}=
4
  • 1
    \expandafter\tagmcbegin\expandafter{\g__last_mc_tl}, or in latex3's way \exp_args:No\tagmcbegin{\g__last_mc_tl}. – muzimuzhi Z Nov 27 '20 at 23:33
  • @muzimuzhi Z Thank you very much for your help. Why we use o param in exp_args as second argument instead of,for example,x or v? – Aleksandr Kozlovskiy Nov 28 '20 at 0:03
  • And why for \expandaftewr we should use it twice,i.e why we need in double expanding? – Aleksandr Kozlovskiy Nov 28 '20 at 0:35
  • 1) To get the value stored in a latex3 tl variable, o (expand once) and V (get the value of variable) are more or less equivalent, though I guess o would be faster. x or e (exhaustive expansion) might fail if, for example \tl_gset:Nn \g__mc_tl{key=\def\x{}}. 2) In \tagmcbegin{\g__last_mc_tl}, we want to firstly expand the third token \g__last_mc_tl once, hence the first two tokens (\tagmcbegin and {) are prefixed by \expandaters. – muzimuzhi Z Nov 28 '20 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.