LaTeX3 : passage d'argument
J'utilise la commande '\dicStylePhonetic' pour formater une chaîne de caractère.
Si je passe une chaîne de caractère en argument alors la chaîne est retournée formatée.
En revanche, si je stocke la chaîne dans une commande alors la chaîne est retournée n'est pas formatée. Et je ne trouve pas la solution.
\documentclass{article}%
\usepackage{color}
\ExplSyntaxOn%
\NewDocumentCommand{\dicStr}{}{weak /bi, bɪ/ /bi/ strong /biː/}%
/bi/}%
\NewDocumentCommand{\dicStylePhonetic}{ m }{%
\tl_set:Nn \l_tmpa_tl { #1 }%
\regex_replace_case_all:nN {
{ (weak|strong) } { \c{textcolor}\cB\{violet\cE\} \cB\{ \1 \cE\} }%
} \l_tmpa_tl
\tl_use:N \l_tmpa_tl%
}%
\ExplSyntaxOff%
\begin{document}%
\dicStylePhonetic{/ˈklevər/}%
\dicStylePhonetic{/klever/}%
\dicStylePhonetic{\dicStr{}}%
\end{document}%