3

I want to feed \url with the value of a property list

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\ExplSyntaxOn
\prop_set_from_keyval:Nn \l_tmpa_prop {
  mail=user@domain,
}
\prop_get:NnN \l_tmpa_prop { mail } \l_tmpa_tl
\url{\l_tmpa_tl}
\end{document}

What I get is \unhbox\voidb@x\bgroup\@xxxiil\egroup_tmpa_tl. How can I obtain user@domain instead?

2 Answers 2

3

You want to pass the value to \url, not the variable.

\documentclass{article}
\usepackage{hyperref}

\begin{document}

\ExplSyntaxOn

\prop_set_from_keyval:Nn \l_tmpa_prop {
  mail=user@domain,
}
\prop_get:NnN \l_tmpa_prop { mail } \l_tmpa_tl
\exp_args:NV \url \l_tmpa_tl

\ExplSyntaxOff

\end{document}

Here \exp_args:NV jumps over the first token because of N and provides the Value of the variable enclosed in braces.

1

You have to expand \l_tmpa_tl, which I accomplish with \expandafter\url\expandafter{\l_tmpa_tl}.

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\ExplSyntaxOn
\prop_set_from_keyval:Nn \l_tmpa_prop {
  mail=user@domain,
}
\prop_get:NnN \l_tmpa_prop { mail } \l_tmpa_tl
\expandafter\url\expandafter{\l_tmpa_tl}
\end{document}

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.