I'm trying to build a simple replacements dictionary using a prop
structure of replacements old=new
. When I'm mapping through the prop
, I don't find any replacements. When I'm not (i.e., hardcoding), I do. What's going on here?
MWE
\nonstopmode
\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
\prop_put:Nnn \l_tmpa_prop {sean} {patrick}
\msg_term:n {resolving}
\tl_set:Nn \l_tmpa_tl {hello,~sean}
\prop_map_inline:Nn \l_tmpa_prop
{
\tl_show:N \l_tmpa_tl
\tl_show:n {#1}
\tl_if_in:VnTF \l_tmpa_tl {#1}
{ \msg_term:n {`#1'~found~in~`\l_tmpa_tl'} }
{ \msg_term:n {`#1'~not~found~in~`\l_tmpa_tl'} }
}
\msg_term:n {contrived}
\tl_show:N \l_tmpa_tl
\tl_show:n {sean}
\tl_if_in:VnTF \l_tmpa_tl {sean}
{ \msg_term:n {oh,~yes~it~is!} }
{ \msg_term:n {nope} }
\ExplSyntaxOff
\begin{document}
hello
\end{document}
Output
* resolving
*************************************************
> \l_tmpa_tl=hello, sean.
<recently read> }
l.18 }
> sean.
<recently read> }
l.18 }
*************************************************
* `sean' not found in `hello, sean'
*************************************************
*************************************************
* contrived
*************************************************
> \l_tmpa_tl=hello, sean.
<recently read> }
l.21 \tl_show:N \l_tmpa_tl
> sean.
<recently read> }
l.22 \tl_show:n {sean}
*************************************************
* oh, yes it is!
\l_tmpa_tl
is still the same you expect it to be? And shouldn't it be\tl_if_in:VnTF {#2} ...
?contrived
example; it certainly looks to me like each piece of state is the same.#2
vs{#2}
: no, I don't think so (though I did try that). It's my understanding that capital-letter arguments are given without braces (e.g.\tl_new:N \l_my_tl
).