1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
\documentclass{article}
\usepackage{xcolor}
\usepackage{ltxkeys}
\makeatletter
\def\somemethod#1#2{%
\begingroup
\color{#1}%
\ifltxkeys@novalue
\ifnum\ltxkeys@listcount=\@ne
\endgraf
Using default value of `\ltxkeys@tkey':
\fi
\else
\ifnum\ltxkeys@listcount=\@ne
\endgraf
Using user value of `\ltxkeys@tkey':
\fi
\fi
\endgroup
\endgraf
Processing item no. \ltxkeys@listcount: #2%
}
% Use comma (,), the default list separator, as the list separator
% for keya and keyb:
\ltxkeys@listkey[KV]{fam}{keya,keyb}[default1,default2]{%
\somemethod{blue}{#1}%
% Process only four (4) items of the list/value for keya and keyb:
\ifnum\ltxkeys@listcount=4\relax
\stopprocessinglistkey
\fi
}
% Use semicolon (;) as the list separator for keyc and keyd:
\ltxkeys@listkey[KV]{fam}{keyc,keyd}[default1;default2]{%
\listsep{;}\somemethod{red}{#1}%
}
\makeatother
\begin{document}
\parindent0pt
% No values for keya and keyb; use their default values:
\ltxkeysusekeys[KV]{fam}{keya,keyb}
\par\bigskip
\ltxkeysusekeys[KV]{fam}{%
keya={item1A,item1B,item1C,item1D,item1E,item1F},
keyb={item2A,item2B,item2C,item2D,item2E,item2F}
}
\par\bigskip
% Set keyc and keyd with their default values:
\ltxkeysusekeys[KV]{fam}{keyc,keyd}
\par\bigskip
\ltxkeysusekeys[KV]{fam}{%
keyc={item1A;item1B;item1C;item1D},
keyd={item2A;item2B;item2C;item2D}
}
\end{document}
|