In my package I intend to write in expl3 syntax, how can I get access to the list of options passed to it on the document level via \usepackage[<option list>]{my-l3-pkg}
?
I know more or less how to define and set keys using the functions provided by the l3keys
package. I don't know yet, which variable holds the contents of <option list>
I could pass to \keys_set:..
.
Is there some replacement for the LaTeX2e functions \DeclareOption
and \ProcessOptions
?
Best Answer
First, bear in mind that what we are talking about is LaTeX3 syntax on top of LaTeX2e. That means that LaTeX2e conventions apply to some extent. In particular, LaTeX2e expands options and removes spaces. So you have to be a little wary in what you set up as load-time package options.
Now, as LaTeX2e is still actually doing the processing, the main macros remain:
\DeclareOption
and\ProcessOptions
. However, if you want to create key-value options you are best off loading the support packagel3keys2e
. This enables you you process LaTeX2e package or class options using the key-value system provided byexpl3
. What you then need to do is a two-step process:\keys_define:nn
\ProcessKeysOptions
You might therefore have something like
Any key which is declared before
\ProcessKeysOptions
is treated as a potential package option (this is true for other key-value approaches to package options).