I'm trying my hand at expl3 for the first time right now, and while tinkering I ran into an error that I cannot wrap my head around: Every time I try to use the result of a tl_use
or a clist_item
as the second argument to \colorlet
from xcolor something breaks completely.
Concretely, here's a small example:
\documentclass{article}
\usepackage{xcolor}
\ExplSyntaxOn
\tl_new:N \l__color_dummy_tl
\cs_new:Npn \passcolorthrough #1 {
\tl_set:Nn \l__color_dummy_tl {#1}
\tl_use:N \l__color_dummy_tl
}
\ExplSyntaxOff
\colorlet{mycolor}{\passcolorthrough{black}} % <- Error's here
\begin{document}
:(
\end{document}
Compiling this with a recent TexLive version yields the following error:
Runaway argument?
\XC@func >\@nnil \edef \@@tmp {{\@@mod }{\@@clr }}\aftergroupdef \@@clr \ETC.
! Paragraph ended before \XC@split@iv was complete.
<to be read again>
\par
l.14
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text.
I haven't been able to make heads or tails of this. Replacing \l__color_dummy_tl
with a clist and \tl_use
with \clist_item
yields the same error.
What's the issue here, and how do I avoid it?
\colorlet
have to expand to a color.\tl_set:Nn
is\def
and not expandable\colorlet{mycolor}{\newcommand\tmp{black}\tmp}
it isn't related to expl3\l__color_dummy_tl
above by a seq or clist and the appropriate accessors, and you basically have my use case. (I'm not going to edit the question now since there's an answer already.)