Download ltxkeys-guide.
Transcript
The ltxkeys package
6th February 2012
to represent the current key prefix, #2 for the current family, #3 for the current key name, and #4
for the value of the current key. The command \ltxkeys@unknownoptionhandler is equivalent to
the starred (?) variant of \ltxkeys@declareoption.
Note 11.1 The starred (?) variant of \ltxkeys@declareoption differs from the starred form of
LATEX’s \DeclareOption and the starred form of xkeyval package’s \DeclareOptionX.
Examples: \ltxkeys@declareoption
656
\ltxkeys@declareoption?[KV]<mypackage>{%
\PackageWarning{mypackage}{%
Unknown option ‘\CurrentKey’ with value ‘\InnocentVal’ ignored}%
}
657
\ltxkeys@declareoption?{\PassOptionsToClass{#3}{article}}
653
654
655
658
659
660
661
662
663
664
665
666
667
\ltxkeys@unknownoptionhandler[KV]<mypackage>{%
\@expandtwoargs\in@{,#3,}{,\KV@mypackage@handledkeys,}%
\ifin@
% The reader may want to investigate what the parameter texts
% ##1 and ####1 below stand for:
\ltxkeys@ordkey[#1]{#2}{#3}[#4]{\def\x####1{####1xx##1}}%
\else
\PassOptionsToClass{#3}{myclass}%
\fi
}
See note 4.3 for the meaning of the parameter texts in this example. The contents of the macro
\KV@mypackage@handledkeys are handled keys for key prefix KV and family fam. See section 8 for
the meaning of handled keys.
New macros: \ltxkeys@declarecmdoption, \ltxkeys@declarebooloption, etc
668
669
670
671
672
\ltxkeys@declareordoption[hprefi]<hfami>{hoptioni}[hdfti]{hcbki}
\ltxkeys@declarecmdoption[hprefi]<hfami>[hmpi]{hoptioni}[hdfti]{hcbki}
\ltxkeys@declarebooloption[hprefi]<hfami>[hmpi]{hoptioni}[hdfti]{hcbki}
\ltxkeys@declarechoiceoption[hprefi]{hfami}[hmpi]{hoptioni}[hbini]{halti}
[hdfti]{hcbki}
These are the equivalents of the macros \ltxkeys@ordkey, \ltxkeys@cmdkey, \ltxkeys@boolkey
and \ltxkeys@choicekey, respectively, but now the family hfami is optional (as is hprefi) and,
when specified, must be given in angled brackets. The default family name for these new commands is ‘\@currname.\@currext’, i. e., the current style or class filename and filename extension.
\ltxkeys@declareordoption is equivalent to the unstarred variant of \ltxkeys@declareoption.
See the choice keys in subsection 3.8 for the meaning of hbini and halti associated with the
command \ltxkeys@declarechoiceoption.
11.1 Options that share the same attributes
The commands
Macros
673
674
\ltxkeys@declareordoption
\ltxkeys@declarecmdoption
Page 38 of 78