2

Is there a way to catch with the key unknown all the unknown keys, including the keys of submodules?

For instance, in the following code, the unknown key foo/bar is not caught by the key unknown.

\documentclass{article}

\begin{document}

Some text.

\ExplSyntaxOn

\keys_define:nn { MyKeys } { one_key .bool_set:N = \l_my_bool , unknown .code:n = \msg_error:nn { MyModule }{ Unknown~Key } }

\msg_new:nnn { MyModule } { Unknown~Key } { The~unknown~key~has~been~caught. }

\keys_set:nn { MyKeys } { foo / bar }

\ExplSyntaxOff

\end{document}

If I define a key unknown in a submodule called MyKeys / foo with the following code:

\keys_define:nn { MyKeys / foo }
  { unknown .code:n = \msg_error:nn { MyModule }{ Unknown~Key } }

then the unknown key foo/bar is caught (by the key unknown of MyKeys/foo) but I would like to catch all the incorrect keys, including composed keys.

Gaussler
  • 12,801
F. Pantigny
  • 40,250

0 Answers0