Handing keys in environment

alexbuhl alexbuhl at protonmail.com
Mon Nov 6 20:04:56 CET 2023


I am unsure how to use keys in the declaration of environments. How
does one handle the case when the user supplies or does not supply
the key-value pairs ?

\documentclass[a4paper,10pt]{article}

\ExplSyntaxOn

\tl_new:N \tlapis_kl_tl
\tl_new:N \tlapis_lv_tl

\keys_define:nn { tlapis_keys }
{
kl .tl_set:N = \tlapis_kl_tl,
kl .default:n = {red},
kl .initial:n = {red},

lv .tl_set:N = \tlapis_lv_tl,
lv .default:n = {},
lv .initial:n = {},
}

\NewDocumentEnvironment {wvTlapis} { o }
{
\tl_if_novalue:nF {#1}
{ \keys_set:nn {tlapis_keys} {#1} }
}
{ }

\ExplSyntaxOff

\begin{document}

\end{document}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texhax/attachments/20231106/131e3f7c/attachment.htm>


More information about the texhax mailing list.