Download ltxkeys-guide.
Transcript
The ltxkeys package
6th February 2012
5
Checking if a key is defined
New macros: \ltxkeys@ifkeydefTF, \ltxkeys@ifkeydefFT
591
592
\ltxkeys@ifkeydefTF[hprefsi]{hfamsi}{hkeyi}{htruei}{hfalsei}
\ltxkeys@ifkeydefFT[hprefsi]{hfamsi}{hkeyi}{hfalsei}{htruei}
These check if hkeyi is defined with a prefix in hprefsi and in family in hfamsi. If the test proves
that hkeyi is defined, htruei text will be executed; otherwise hfalsei will be executed.
6
Disabling families and keys
6.1 Disabling families
New macro: \ltxkeys@disablefamilies ,\ltxkeys@gdisablefamilies
593
594
595
596
\ltxkeys@disablefamilies[hprefsi]{hfamsi}[hnakeysi]
\ltxkeys@disablefamilies?[hprefsi]{hfamsi}[hnakeysi]
\ltxkeys@gdisablefamilies[hprefsi]{hfamsi}[hnakeysi]
\ltxkeys@gdisablefamilies?[hprefsi]{hfamsi}[hnakeysi]
Here, hprefsi and hfamsi are comma-separated lists of prefixes and families to be disabled. Keys
listed in the comma-separated list hnakeysi are ignored, i. e., they aren’t disabled with their
colleagues. The macros \ltxkeys@disablefamilies and \ltxkeys@gdisablefamilies disable
keys and cause an error to be issued when a disabled family is submitted to \ltxkeys@setkeys
or invoked by the key caller. If the package option tracingkeys is true, disabled families are
highlighted in the transcript file. The command \ltxkeys@disablefamilies acts locally, while
\ltxkeys@gdisablefamilies has a global effect.
The plain forms of \ltxkeys@disablefamilies and \ltxkeys@gdisablefamilies disable the
given families instantly, while the starred (?) variants disable the families at \AtBeginDocument.
Authors can use these commands to bar users of their keys from calling those families after a certain
point. Individual keys in a family can be disabled using the commands \ltxkeys@disablekeys
and \ltxkeys@gdisablekeys.
Example: \ltxkeys@disablefamilies
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
\ltxkeys{%
% The commands \declare@keys, \set@keys and \set@rmkeys are available
% only within \ltxkeys.
\declare@keys*[KV1]{fam1}[mp@]{%
bool/key1/true/\def\xx##1{##1\\#1\\##1};
bool/key2/true/\def\yy##1{##1*#1*##1};
cmd/key3/aaa/;
cmd/key4/bbb/
}%
\\
\declare@keys*[KV2]{fam2}[mp@]{%
bool/key1/true;
bool/key2/true;
cmd/key3/yyy/;
cmd/key4/zzz/
}%
Page 33 of 78