Open kalekje opened 2 years ago
The xparse
arg-spec +b
is the cause. first*=\TestItemize
will append \TestItemize
to \enit@keyfirst
and when the latter expands, \TestItemize
treats the \fi
on line 1382 as part of the environment content.
https://github.com/jbezos/enumitem/blob/1bdcad0987823b3716c86b126b3863f895ea9c4a/enumitem.sty#L1379-L1382
I'm surprised that such usage is ever supported. Usually it's suggested to use any envs that collect its content in the way that when \begin{envname}
expands, \end{envname}
is seen. But since your code is so close to work, with some knowledge about the enumitem
internals, using
\SetEnumitemKey{test}{
first*=\expandafter\TestItemize, % ensure this is the last part stored in `\enum@keyfirst`
after=\endTestItemize,
}
seems to work.
I think this is a bug. I want to make an EnumitemKey to wrap my
\item
s in an environemnt. But the body of theitemize
begins with a\fi
. I see this in my log output:test >>>\fi \item one \item two \item three