%% %% This is file `l3keys.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% l3keys.dtx (with options: `package') %% %% EXPERIMENTAL CODE %% %% Do not distribute this file without also distributing the %% source files specified above. %% %% Do not distribute a modified version of this file. %% %% File: l3keys.dtx Copyright (C) 2006-2011 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this %% license or (at your option) any later version. The latest version %% of this license is in the file %% %% http://www.latex-project.org/lppl.txt %% %% This file is part of the "l3kernel bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% %% The released version of this bundle is available from CTAN. %% %% ----------------------------------------------------------------------- %% %% The development version of the bundle can be found at %% %% http://www.latex-project.org/svnroot/experimental/trunk/ %% %% for those people who are interested. %% %%%%%%%%%%% %% NOTE: %% %%%%%%%%%%% %% %% Snapshots taken from the repository represent work in progress and may %% not work or may contain conflicting material! We therefore ask %% people _not_ to put them into distributions, archives, etc. without %% prior consultation with the LaTeX3 Project. %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} \GetIdInfo$Id: l3keys.dtx 3086 2011-12-22 17:55:46Z bruno $ {L3 Experimental key-value interfaces} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \package_check_loaded_expl: \int_new:N \g_keyval_level_int \tl_new:N \l_keyval_key_tl \tl_new:N \l_keyval_value_tl \tl_new:N \l_keyval_sanitise_tl \tl_new:N \l_keyval_parse_tl \group_begin: \char_set_catcode_active:n { `\= } \char_set_catcode_active:n { `\, } \char_set_lccode:nn { `\8 } { `\= } \char_set_lccode:nn { `\9 } { `\, } \tl_to_lowercase:n { \group_end: \cs_new_protected:Npn \keyval_parse:n #1 { \group_begin: \tl_clear:N \l_keyval_sanitise_tl \tl_set:Nn \l_keyval_sanitise_tl {#1} \tl_replace_all:Nnn \l_keyval_sanitise_tl { = } { 8 } \tl_replace_all:Nnn \l_keyval_sanitise_tl { , } { 9 } \tl_clear:N \l_keyval_parse_tl \exp_after:wN \keyval_parse_elt:w \exp_after:wN \q_no_value \l_keyval_sanitise_tl 9 \q_nil 9 \exp_after:wN \group_end: \l_keyval_parse_tl } } \cs_new_protected:Npn \keyval_parse_elt:w #1 , { \tl_if_blank:oTF { \use_none:n #1 } { \keyval_parse_elt:w \q_no_value } { \quark_if_nil:oF { \use_ii:nn #1 } { \keyval_split_key_value:w #1 = = \q_stop \keyval_parse_elt:w \q_no_value } } } \cs_new_protected:Npn \keyval_split_key_value:w #1 = #2 \q_stop { \keyval_split_key:w #1 \q_stop \str_if_eq:nnTF {#2} { = } { \tl_put_right:Nx \l_keyval_parse_tl { \exp_not:c { keyval_key_no_value_elt_ \int_use:N \g_keyval_level_int :n } { \exp_not:o \l_keyval_key_tl } } } { \keyval_split_key_value_aux:wTF #2 \q_no_value \q_stop { \keyval_split_value:w \q_nil #2 } { \msg_kernel_error:nn { keyval } { misplaced-equals-sign } } } } \cs_new:Npn \keyval_split_key_value_aux:wTF #1 = #2#3 \q_stop { \tl_if_head_eq_meaning:nNTF {#3} \q_no_value } \cs_new_protected:Npn \keyval_split_key:w #1 \q_stop { \tl_set:Nx \l_keyval_key_tl { \exp_after:wN \tl_trim_spaces:n \exp_after:wN { \use_none:n #1 } } } \cs_new_protected:Npn \keyval_split_value:w #1 = = { \tl_put_right:Nx \l_keyval_parse_tl { \exp_not:c { keyval_key_value_elt_ \int_use:N \g_keyval_level_int :nn } { \exp_not:o \l_keyval_key_tl } } \tl_set:Nx \l_keyval_value_tl { \exp_not:o { \use_none:nnn #1 \q_nil \q_nil } } \tl_if_empty:NTF \l_keyval_value_tl { \tl_put_right:Nn \l_keyval_parse_tl { { } } } { \quark_if_nil:NTF \l_keyval_value_tl { \tl_put_right:Nx \l_keyval_parse_tl { { \exp_not:o { \use_ii:nnn #1 \q_nil } } } } { \keyval_split_value_aux:w #1 \q_stop } } } \cs_new_protected:Npn \keyval_split_value_aux:w \q_nil #1 \q_stop { \tl_set:Nx \l_keyval_value_tl { \tl_trim_spaces:n {#1} } \tl_put_right:Nx \l_keyval_parse_tl { { \exp_not:o \l_keyval_value_tl } } } \cs_new_protected:Npn \keyval_parse:NNn #1#2#3 { \int_gincr:N \g_keyval_level_int \cs_gset_eq:cN { keyval_key_no_value_elt_ \int_use:N \g_keyval_level_int :n } #1 \cs_gset_eq:cN { keyval_key_value_elt_ \int_use:N \g_keyval_level_int :nn } #2 \keyval_parse:n {#3} \int_gdecr:N \g_keyval_level_int } \msg_kernel_new:nnnn { keyval } { misplaced-equals-sign } { Misplaced~equals~sign~in~key-value~input~\msg_line_number: } { LaTeX~is~attempting~to~parse~some~key-value~input~but~found~ two~equals~signs~not~separated~by~a~comma. } \tl_const:Nn \c_keys_code_root_tl { key~code~>~ } \tl_const:Nn \c_keys_vars_root_tl { key~var~>~ } \tl_const:Nn \c_keys_props_root_tl { key~prop~>~ } \tl_const:Nn \c_keys_value_forbidden_tl { forbidden } \tl_const:Nn \c_keys_value_required_tl { required } \int_new:N \l_keys_choice_int \tl_new:N \l_keys_choices_tl \tl_new:N \l_keys_key_tl \tl_new:N \l_keys_module_tl \bool_new:N \l_keys_no_value_bool \tl_new:N \l_keys_path_tl \tl_new:N \l_keys_property_tl \tl_new:N \l_keys_unknown_clist \tl_new:N \l_keys_value_tl \cs_new_protected:Npn \keys_define:nn { \keys_define_aux:onn \l_keys_module_tl } \cs_new_protected:Npn \keys_define_aux:nnn #1#2#3 { \tl_set:Nx \l_keys_module_tl { \tl_to_str:n {#2} } \keyval_parse:NNn \keys_define_elt:n \keys_define_elt:nn {#3} \tl_set:Nn \l_keys_module_tl {#1} } \cs_generate_variant:Nn \keys_define_aux:nnn { o } \cs_new_protected:Npn \keys_define_elt:n #1 { \bool_set_true:N \l_keys_no_value_bool \keys_define_elt_aux:nn {#1} { } } \cs_new_protected:Npn \keys_define_elt:nn #1#2 { \bool_set_false:N \l_keys_no_value_bool \keys_define_elt_aux:nn {#1} {#2} } \cs_new_protected:Npn \keys_define_elt_aux:nn #1#2 { \keys_property_find:n {#1} \cs_if_exist:cTF { \c_keys_props_root_tl \l_keys_property_tl } { \keys_define_key:n {#2} } { \msg_kernel_error:nnxx { keys } { property-unknown } { \l_keys_property_tl } { \l_keys_path_tl } } } \cs_new_protected:Npn \keys_property_find:n #1 { \tl_set:Nx \l_keys_path_tl { \l_keys_module_tl / } \tl_if_in:nnTF {#1} { . } { \keys_property_find_aux:w #1 \q_stop } { \msg_kernel_error:nnx { keys } { key-no-property } {#1} } } \cs_new_protected:Npn \keys_property_find_aux:w #1 . #2 \q_stop { \tl_set:Nx \l_keys_path_tl { \l_keys_path_tl \tl_to_str:n {#1} } \tl_if_in:nnTF {#2} { . } { \tl_set:Nx \l_keys_path_tl { \l_keys_path_tl . } \keys_property_find_aux:w #2 \q_stop } { \tl_set:Nn \l_keys_property_tl { . #2 } } } \cs_new_protected:Npn \keys_define_key:n #1 { \bool_if:NTF \l_keys_no_value_bool { \exp_after:wN \keys_define_key_aux:w \l_keys_property_tl \q_stop { \use:c { \c_keys_props_root_tl \l_keys_property_tl } } { \msg_kernel_error:nnxx { keys } { property-requires-value } { \l_keys_property_tl } { \l_keys_path_tl } } } { \use:c { \c_keys_props_root_tl \l_keys_property_tl } {#1} } } \cs_new_protected:Npn \keys_define_key_aux:w #1 : #2 \q_stop { \tl_if_empty:nTF {#2} } \cs_new:Npn \keys_bool_set:NN #1#2 { \cs_if_exist:NF #1 { \bool_new:N #1 } \keys_choice_make: \keys_cmd_set:nx { \l_keys_path_tl / true } { \exp_not:c { bool_ #2 set_true:N } \exp_not:N #1 } \keys_cmd_set:nx { \l_keys_path_tl / false } { \exp_not:c { bool_ #2 set_false:N } \exp_not:N #1 } \keys_cmd_set:nn { \l_keys_path_tl / unknown } { \msg_kernel_error:nnx { keys } { boolean-values-only } { \l_keys_key_tl } } \keys_default_set:n { true } } \cs_new:Npn \keys_bool_set_inverse:NN #1#2 { \cs_if_exist:NF #1 { \bool_new:N #1 } \keys_choice_make: \keys_cmd_set:nx { \l_keys_path_tl / true } { \exp_not:c { bool_ #2 set_false:N } \exp_not:N #1 } \keys_cmd_set:nx { \l_keys_path_tl / false } { \exp_not:c { bool_ #2 set_true:N } \exp_not:N #1 } \keys_cmd_set:nn { \l_keys_path_tl / unknown } { \msg_kernel_error:nnx { keys } { boolean-values-only } { \l_keys_key_tl } } \keys_default_set:n { true } } \cs_new_protected_nopar:Npn \keys_choice_make: { \keys_cmd_set:nn { \l_keys_path_tl } { \keys_choice_find:n {##1} } \keys_cmd_set:nn { \l_keys_path_tl / unknown } { \msg_kernel_error:nnxx { keys } { choice-unknown } { \l_keys_path_tl } {##1} } } \cs_new_protected:Npn \keys_choices_make:nn #1#2 { \keys_choice_make: \int_zero:N \l_keys_choice_int \clist_map_inline:nn {#1} { \keys_cmd_set:nx { \l_keys_path_tl / ##1 } { \tl_set:Nn \exp_not:N \l_keys_choice_tl {##1} \int_set:Nn \exp_not:N \l_keys_choice_int { \int_use:N \l_keys_choice_int } \exp_not:n {#2} } \int_incr:N \l_keys_choice_int } } \cs_new_protected:Npn \keys_choices_generate:n #1 { \cs_if_exist:cTF { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } { \keys_choice_make: \int_zero:N \l_keys_choice_int \clist_map_function:nN {#1} \keys_choices_generate_aux:n } { \msg_kernel_error:nnx { keys } { generate-choices-before-code } { \l_keys_path_tl } } } \cs_new_protected:Npn \keys_choices_generate_aux:n #1 { \keys_cmd_set:nx { \l_keys_path_tl / #1 } { \tl_set:Nn \exp_not:N \l_keys_choice_tl {#1} \int_set:Nn \exp_not:N \l_keys_choice_int { \int_use:N \l_keys_choice_int } \exp_not:v { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } } \int_incr:N \l_keys_choice_int } \cs_new_protected:Npn \keys_choice_code_store:x #1 { \cs_if_exist:cF { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } { \tl_new:c { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } } \tl_set:cx { \c_keys_vars_root_tl \l_keys_path_tl .choice~code } {#1} } \cs_new_protected:Npn \keys_cmd_set:nn #1#2 { \keys_cmd_set_aux:n {#1} \cs_set:cpn { \c_keys_code_root_tl #1 } ##1 {#2} } \cs_new_protected:Npn \keys_cmd_set:nx #1#2 { \keys_cmd_set_aux:n {#1} \cs_set:cpx { \c_keys_code_root_tl #1 } ##1 {#2} } \cs_new_protected:Npn \keys_cmd_set_aux:n #1 { \tl_clear_new:c { \c_keys_vars_root_tl #1 .default } \tl_set:cn { \c_keys_vars_root_tl #1 .default } { \q_no_value } \tl_clear_new:c { \c_keys_vars_root_tl #1 .req } } \cs_new_protected:Npn \keys_default_set:n #1 { \tl_set:cn { \c_keys_vars_root_tl \l_keys_path_tl .default } {#1} } \cs_generate_variant:Nn \keys_default_set:n { V } \cs_new_protected:Npn \keys_meta_make:n #1 { \exp_args:NNo \keys_cmd_set:nn \l_keys_path_tl { \exp_after:wN \keys_set:nn \exp_after:wN { \l_keys_module_tl } {#1} } } \cs_new_protected:Npn \keys_meta_make:x #1 { \keys_cmd_set:nx { \l_keys_path_tl } { \exp_not:N \keys_set:nn { \l_keys_module_tl } {#1} } } \cs_new:Npn \keys_multichoice_find:n #1 { \clist_map_function:nN {#1} \keys_choice_find:n } \cs_new_protected_nopar:Npn \keys_multichoice_make: { \keys_cmd_set:nn { \l_keys_path_tl } { \keys_multichoice_find:n {##1} } \keys_cmd_set:nn { \l_keys_path_tl / unknown } { \msg_kernel_error:nnxx { keys } { choice-unknown } { \l_keys_path_tl } {##1} } } \cs_new_protected:Npn \keys_multichoices_make:nn #1#2 { \keys_multichoice_make: \int_zero:N \l_keys_choice_int \clist_map_inline:nn {#1} { \keys_cmd_set:nx { \l_keys_path_tl / ##1 } { \tl_set:Nn \exp_not:N \l_keys_choice_tl {##1} \int_set:Nn \exp_not:N \l_keys_choice_int { \int_use:N \l_keys_choice_int } \exp_not:n {#2} } \int_incr:N \l_keys_choice_int } } \cs_new_protected:Npn \keys_value_requirement:n #1 { \tl_set_eq:cc { \c_keys_vars_root_tl \l_keys_path_tl .req } { c_keys_value_ #1 _tl } } \cs_new_protected:Npn \keys_variable_set:NnNN #1#2#3#4 { \cs_if_exist:NF #1 { \use:c { #2 _new:N } #1 } \keys_cmd_set:nx { \l_keys_path_tl } { \exp_not:c { #2 _ #3 set:N #4 } \exp_not:N #1 {##1} } } \cs_new_protected:Npn \keys_variable_set:NnN #1#2#3 { \keys_variable_set:NnNN #1 {#2} { } #3 } \cs_generate_variant:Nn \keys_variable_set:NnNN { c } \cs_generate_variant:Nn \keys_variable_set:NnN { c } \cs_new_protected:cpn { \c_keys_props_root_tl .bool_set:N } #1 { \keys_bool_set:NN #1 { } } \cs_new_protected:cpn { \c_keys_props_root_tl .bool_gset:N } #1 { \keys_bool_set:NN #1 g } \cs_new_protected:cpn { \c_keys_props_root_tl .bool_set_inverse:N } #1 { \keys_bool_set_inverse:NN #1 { } } \cs_new_protected:cpn { \c_keys_props_root_tl .bool_gset_inverse:N } #1 { \keys_bool_set_inverse:NN #1 g } \cs_new_protected_nopar:cpn { \c_keys_props_root_tl .choice: } { \keys_choice_make: } \cs_new_protected:cpn { \c_keys_props_root_tl .choices:nn } #1 { \keys_choices_make:nn #1 } \cs_new_protected:cpn { \c_keys_props_root_tl .code:n } #1 { \keys_cmd_set:nn { \l_keys_path_tl } {#1} } \cs_new_protected:cpn { \c_keys_props_root_tl .code:x } #1 { \keys_cmd_set:nx { \l_keys_path_tl } {#1} } \cs_new_protected:cpn { \c_keys_props_root_tl .choice_code:n } #1 { \keys_choice_code_store:x { \exp_not:n {#1} } } \cs_new_protected:cpn { \c_keys_props_root_tl .choice_code:x } #1 { \keys_choice_code_store:x {#1} } \cs_new_protected:cpn { \c_keys_props_root_tl .clist_set:N } #1 { \keys_variable_set:NnN #1 { clist } n } \cs_new_protected:cpn { \c_keys_props_root_tl .clist_set:c } #1 { \keys_variable_set:cnN {#1} { clist } n } \cs_new_protected:cpn { \c_keys_props_root_tl .clist_gset:N } #1 { \keys_variable_set:NnNN #1 { clist } g n } \cs_new_protected:cpn { \c_keys_props_root_tl .clist_gset:c } #1 { \keys_variable_set:cnNN {#1} { clist } g n } \cs_new_protected:cpn { \c_keys_props_root_tl .default:n } #1 { \keys_default_set:n {#1} } \cs_new_protected:cpn { \c_keys_props_root_tl .default:V } #1 { \keys_default_set:V #1 } \cs_new_protected:cpn { \c_keys_props_root_tl .dim_set:N } #1 { \keys_variable_set:NnN #1 { dim } n } \cs_new_protected:cpn { \c_keys_props_root_tl .dim_set:c } #1 { \keys_variable_set:cnN {#1} { dim } n } \cs_new_protected:cpn { \c_keys_props_root_tl .dim_gset:N } #1 { \keys_variable_set:NnNN #1 { dim } g n } \cs_new_protected:cpn { \c_keys_props_root_tl .dim_gset:c } #1 { \keys_variable_set:cnNN {#1} { dim } g n } \cs_new_protected:cpn { \c_keys_props_root_tl .fp_set:N } #1 { \keys_variable_set:NnN #1 { fp } n } \cs_new_protected:cpn { \c_keys_props_root_tl .fp_set:c } #1 { \keys_variable_set:cnN {#1} { fp } n } \cs_new_protected:cpn { \c_keys_props_root_tl .fp_gset:N } #1 { \keys_variable_set:NnNN #1 { fp } g n } \cs_new_protected:cpn { \c_keys_props_root_tl .fp_gset:c } #1 { \keys_variable_set:cnNN {#1} { fp } g n } \cs_new_protected:cpn { \c_keys_props_root_tl .generate_choices:n } #1 { \keys_choices_generate:n {#1} } \cs_new_protected:cpn { \c_keys_props_root_tl .int_set:N } #1 { \keys_variable_set:NnN #1 { int } n } \cs_new_protected:cpn { \c_keys_props_root_tl .int_set:c } #1 { \keys_variable_set:cnN {#1} { int } n } \cs_new_protected:cpn { \c_keys_props_root_tl .int_gset:N } #1 { \keys_variable_set:NnNN #1 { int } g n } \cs_new_protected:cpn { \c_keys_props_root_tl .int_gset:c } #1 { \keys_variable_set:cnNN {#1} { int } g n } \cs_new_protected:cpn { \c_keys_props_root_tl .meta:n } #1 { \keys_meta_make:n {#1} } \cs_new_protected:cpn { \c_keys_props_root_tl .meta:x } #1 { \keys_meta_make:x {#1} } \cs_new_protected_nopar:cpn { \c_keys_props_root_tl .multichoice: } { \keys_multichoice_make: } \cs_new_protected:cpn { \c_keys_props_root_tl .multichoices:nn } #1 { \keys_multichoices_make:nn #1 } \cs_new_protected:cpn { \c_keys_props_root_tl .skip_set:N } #1 { \keys_variable_set:NnN #1 { skip } n } \cs_new_protected:cpn { \c_keys_props_root_tl .skip_set:c } #1 { \keys_variable_set:cnN {#1} { skip } n } \cs_new_protected:cpn { \c_keys_props_root_tl .skip_gset:N } #1 { \keys_variable_set:NnNN #1 { skip } g n } \cs_new_protected:cpn { \c_keys_props_root_tl .skip_gset:c } #1 { \keys_variable_set:cnNN {#1} { skip } g n } \cs_new_protected:cpn { \c_keys_props_root_tl .tl_set:N } #1 { \keys_variable_set:NnN #1 { tl } n } \cs_new_protected:cpn { \c_keys_props_root_tl .tl_set:c } #1 { \keys_variable_set:cnN {#1} { tl } n } \cs_new_protected:cpn { \c_keys_props_root_tl .tl_set_x:N } #1 { \keys_variable_set:NnN #1 { tl } x } \cs_new_protected:cpn { \c_keys_props_root_tl .tl_set_x:c } #1 { \keys_variable_set:cnN {#1} { tl } x } \cs_new_protected:cpn { \c_keys_props_root_tl .tl_gset:N } #1 { \keys_variable_set:NnNN #1 { tl } g n } \cs_new_protected:cpn { \c_keys_props_root_tl .tl_gset:c } #1 { \keys_variable_set:cnNN {#1} { tl } g n } \cs_new_protected:cpn { \c_keys_props_root_tl .tl_gset_x:N } #1 { \keys_variable_set:NnNN #1 { tl } g x } \cs_new_protected:cpn { \c_keys_props_root_tl .tl_gset_x:c } #1 { \keys_variable_set:cnNN {#1} { tl } g x } \cs_new_protected_nopar:cpn { \c_keys_props_root_tl .value_forbidden: } { \keys_value_requirement:n { forbidden } } \cs_new_protected_nopar:cpn { \c_keys_props_root_tl .value_required: } { \keys_value_requirement:n { required } } \cs_new_protected:Npn \keys_set:nn { \keys_set_aux:onn { \l_keys_module_tl } } \cs_new_protected:Npn \keys_set_aux:nnn #1#2#3 { \tl_set:Nx \l_keys_module_tl { \tl_to_str:n {#2} } \keyval_parse:NNn \keys_set_elt:n \keys_set_elt:nn {#3} \tl_set:Nn \l_keys_module_tl {#1} } \cs_generate_variant:Nn \keys_set:nn { nV , nv , no } \cs_generate_variant:Nn \keys_set_aux:nnn { o } \cs_new_protected:Npn \keys_set_known:nnN { \keys_set_known_aux:onnN { \l_keys_module_tl } } \cs_new_protected:Npn \keys_set_known_aux:nnnN #1#2#3#4 { \tl_set:Nx \l_keys_module_tl { \tl_to_str:n {#2} } \clist_clear:N \l_keys_unknown_clist \cs_set_eq:NN \keys_execute_unknown: \keys_execute_unknown_alt: \keyval_parse:NNn \keys_set_elt:n \keys_set_elt:nn {#3} \cs_set_eq:NN \keys_execute_unknown: \keys_execute_unknown_std: \tl_set:Nn \l_keys_module_tl {#1} \clist_set_eq:NN #4 \l_keys_unknown_clist } \cs_generate_variant:Nn \keys_set_known:nnN { nV , nv , no } \cs_generate_variant:Nn \keys_set_known_aux:nnnN { o } \cs_new_protected:Npn \keys_set_elt:n #1 { \bool_set_true:N \l_keys_no_value_bool \keys_set_elt_aux:nn {#1} { } } \cs_new_protected:Npn \keys_set_elt:nn #1#2 { \bool_set_false:N \l_keys_no_value_bool \keys_set_elt_aux:nn {#1} {#2} } \cs_new_protected:Npn \keys_set_elt_aux:nn #1#2 { \tl_set:Nx \l_keys_key_tl { \tl_to_str:n {#1} } \tl_set:Nx \l_keys_path_tl { \l_keys_module_tl / \l_keys_key_tl } \keys_value_or_default:n {#2} \bool_if:nTF { \keys_if_value_p:n { required } && \l_keys_no_value_bool } { \msg_kernel_error:nnx { keys } { value-required } { \l_keys_path_tl } } { \bool_if:nTF { \keys_if_value_p:n { forbidden } && ! \l_keys_no_value_bool } { \msg_kernel_error:nnxx { keys } { value-forbidden } { \l_keys_path_tl } { \l_keys_value_tl } } { \keys_execute: } } } \cs_new_protected:Npn \keys_value_or_default:n #1 { \tl_set:Nn \l_keys_value_tl {#1} \bool_if:NT \l_keys_no_value_bool { \quark_if_no_value:cF { \c_keys_vars_root_tl \l_keys_path_tl .default } { \cs_if_exist:cT { \c_keys_vars_root_tl \l_keys_path_tl .default } { \tl_set_eq:Nc \l_keys_value_tl { \c_keys_vars_root_tl \l_keys_path_tl .default } } } } } \prg_new_conditional:Npnn \keys_if_value:n #1 { p } { \tl_if_eq:ccTF { c_keys_value_ #1 _tl } { \c_keys_vars_root_tl \l_keys_path_tl .req } { \prg_return_true: } { \prg_return_false: } } \cs_new_nopar:Npn \keys_execute: { \keys_execute:nn { \l_keys_path_tl } { \keys_execute_unknown: } } \cs_new_nopar:Npn \keys_execute_unknown: { \keys_execute:nn { \l_keys_module_tl / unknown } { \msg_kernel_error:nnxx { keys } { key-unknown } { \l_keys_path_tl } { \l_keys_module_tl } } } \cs_new_eq:NN \keys_execute_unknown_std: \keys_execute_unknown: \cs_new_nopar:Npn \keys_execute_unknown_alt: { \clist_put_right:Nx \l_keys_unknown_clist { \exp_not:o \l_keys_key_tl \bool_if:NF \l_keys_no_value_bool { = { \exp_not:o \l_keys_value_tl } } } } \cs_new:Npn \keys_execute:nn #1#2 { \cs_if_exist:cTF { \c_keys_code_root_tl #1 } { \exp_args:Nno \use:c { \c_keys_code_root_tl #1 } \l_keys_value_tl } {#2} } \cs_new:Npn \keys_choice_find:n #1 { \keys_execute:nn { \l_keys_path_tl / \tl_to_str:n {#1} } { \keys_execute:nn { \l_keys_path_tl / unknown } { } } } \prg_new_conditional:Npnn \keys_if_exist:nn #1#2 { p , T , F , TF } { \cs_if_exist:cTF { \c_keys_code_root_tl #1 / #2 } { \prg_return_true: } { \prg_return_false: } } \prg_new_conditional:Npnn \keys_if_choice_exist:nnn #1#2#3 { p , T , F , TF } { \cs_if_exist:cTF { \c_keys_code_root_tl #1 / #2 / #3 } { \prg_return_true: } { \prg_return_false: } } \cs_new:Npn \keys_show:nn #1#2 { \cs_show:c { \c_keys_code_root_tl #1 / \tl_to_str:n {#2} } } \msg_kernel_new:nnnn { keys } { boolean-values-only } { Key~'#1'~accepts~boolean~values~only. } { The~key~'#1'~only~accepts~the~values~'true'~and~'false'. } \msg_kernel_new:nnnn { keys } { choice-unknown } { Choice~'#2'~unknown~for~key~'#1'. } { The~key~'#1'~takes~a~limited~number~of~values.\\ The~input~given,~'#2',~is~not~on~the~list~accepted. } \msg_kernel_new:nnnn { keys } { generate-choices-before-code } { No~code~available~to~generate~choices~for~key~'#1'. } { \c_msg_coding_error_text_tl Before~using~.generate_choices:n~the~code~should~be~defined~ with~'.choice_code:n'~or~'.choice_code:x'. } \msg_kernel_new:nnnn { keys } { key-no-property } { No~property~given~in~definition~of~key~'#1'. } { \c_msg_coding_error_text_tl Inside~\keys_define:nn each~key~name needs~a~property: \\ ~ ~ #1 . \\ LaTeX~did~not~find~a~'.'~to~indicate~the~start~of~a~property. } \msg_kernel_new:nnnn { keys } { key-unknown } { The~key~'#1'~is~unknown~and~is~being~ignored. } { The~module~'#2'~does~not~have~a~key~called~#1'.\\ Check~that~you~have~spelled~the~key~name~correctly. } \msg_kernel_new:nnnn { keys } { option-unknown } { Unknown~option~'#1'~for~package~#2. } { LaTeX~has~been~asked~to~set~an~option~called~'#1'~ but~the~#2~package~has~not~created~an~option~with~this~name. } \msg_kernel_new:nnnn { keys } { property-requires-value } { The~property~'#1'~requires~a~value. } { \c_msg_coding_error_text_tl LaTeX~was~asked~to~set~property~'#2'~for~key~'#1'.\\ No~value~was~given~for~the~property,~and~one~is~required. } \msg_kernel_new:nnnn { keys } { property-unknown } { The~key~property~'#1'~is~unknown. } { \c_msg_coding_error_text_tl LaTeX~has~been~asked~to~set~the~property~'#1'~for~key~'#2':~ this~property~is~not~defined. } \msg_kernel_new:nnnn { keys } { value-forbidden } { The~key~'#1'~does~not~taken~a~value. } { The~key~'#1'~should~be~given~without~a~value.\\ LaTeX~will~ignore~the~given~value~'#2'. } \msg_kernel_new:nnnn { keys } { value-required } { The~key~'#1'~requires~a~value. } { The~key~'#1'~must~have~a~value.\\ No~value~was~present:~the~key~will~be~ignored. } %% %% %% End of file `l3keys.sty'.