In the interface3
documentation it can be read (what follows is not a literal quotation) that the variable \l_keys_choice_int
is available to be used as an index register for a multiple-choices key with its values starting up from 0
. Nonetheless, according to my experience with the code below, it is as though the starting value is actually 1
.
This is my class, in a file insightfully called myclass.cls
:
\RequirePackage{l3keys2e,xparse}
\ProvidesExplClass
{myclass}
{2013/08/25}
{1.0}
{myclass}
\bool_new:N \g_myclass_enum_bool
\bool_new:N \g_myclass_enumalt_bool
\NewDocumentCommand \SetTBool { m }
{
\bool_gset_true:c
{ g_myclass_\tl_trim_spaces:n {#1} _bool}
}
\NewDocumentCommand \TypeBool { m }
{ \bool_if:cTF { g_myclass_#1_bool } { T } { F } }
\keys_define:nn { myclass }
{
alter .choice_code:n =
{
\AtBeginDocument{Option ~ Index: ~ \int_use:N \l_keys_choice_int\par}
\int_compare:nNnTF { \l_keys_choice_int } = { 1 }
{ \SetTBool { enum } }
{ \SetTBool { enumalt } }
},
alter .generate_choices:n = { enum, enumalt }
}
\ProcessKeysOptions { myclass }
\LoadClass{memoir}
Then I have a document file by the original name mydoc.tex
reading thus:
\documentclass[alter = enum]{myclass}
\begin{document}
\TypeBool{enum}\par
\TypeBool{enumalt}
\end{document}
What I get in my typeset document is 1 T F
, whereas according to the documentation I should get 0 T F
. Moreover, if I set the class option alter = enumalt
, I get 2 F T
. Am I getting something wrong?