diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-test-20121122.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-test-20121122.tex | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-test-20121122.tex b/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-test-20121122.tex new file mode 100644 index 00000000000..725126ab120 --- /dev/null +++ b/Master/texmf-dist/doc/latex/ltxkeys/ltxkeys-test-20121122.tex @@ -0,0 +1,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} + |