I am trying to understand whether there is a proper expl3 way to achieve the same result as the latex2e \protected@edef
, that is expanding a token list while respecting the \protect
mechanism of latex2e.
Using expl3 functions with an "x" type argument (e.g. \tl_gset:Nx
) seems to expand everything ignoring the latex2e protection mechanism.
I seem to be able to achieve the desired goal by manually replicating the mechanisms applied by \protected@edef
, that is by doing a \tl_set:Nn \protect { \noexpand\protect\noexpand }
right before the "x" expansion (e.g., before the \tl_gset:Nx
), but I wonder if this is the preferred method or if there are more elegant alternatives.