Why does a choice key not save it’s value to a macro as a cmd key and as the corresponding xkeyval \define@choicekey do?
In the following example I have to define my@key manually by using the callback.
\documentclass{article}
\usepackage{keyreader}
\krddefinekeys*{CL}[my]{%
choice/keya/one/
one,two,three/\def\mykeya{#1};
choice/keyb/aa/
aa,bb,cc,dd;
}
\begin{document}
\mykeya% works
and
%\mykeyb% doesn't work
\end{document}
With xkeyval it is possible to define a bin i.e. a macro that saves the value:
\define@choicekey*{CL}{keyc}[\mybin]{alpha,beta,gamma,epsilon}[alpha]{}
an later \mybin holds the value of keyc
binto save the value, please see my edit. Thath’s what I meant but had it wrong in my mind O:-) – Tobi Mar 04 '12 at 02:34\bina(to hold current user value) and\binb(to hold the numerical order of the user input, starting from 0). Your\mybinis well placed. NOTE: It is advisable to always provide a key prefix (eg,[TOB]) and a family (eg,{tobi}). – Ahmed Musa Mar 04 '12 at 03:19\krddefinekeysright?. Why is it better to define a prefix? And why it this argument optional, though? – Tobi Mar 04 '12 at 12:20\krddefinekeysfor choice keys (like it has always been for command keys). It will take perhaps 24 hours before the upload is propagated to mirror sites. So for a choice keykeya, you can now have\mykeyaas you wanted. Note: Providing both key prefix and family makes your keys unique and reduces the chances of name clashes within and between packages. The default value of key prefix is often KV. – Ahmed Musa Mar 04 '12 at 16:03<mpprefix>(\my) in my example the prefix isn’t uses anywhere, is it? – Tobi Mar 04 '12 at 17:22\mykeyaand\mykeyb. You won't need to define\def\mykeya{#1}yourself. – Ahmed Musa Mar 04 '12 at 21:27\cmdKV@keya. But if I define the mprefix it’s\mykeyaso the prefix isn’t used and for that can’t help to avoid conflicts … – Tobi Mar 05 '12 at 00:51myas in your example above), then\cmd<keyprefix>@<family>@<keyname>will not be formed and used internally. You can avoid name clash by choosing a unique macro prefix (say,tobi@mypkg@). Another point: in the\krddefinekeyscommand, the bins for choice keys are always\krduserinputand\krdorder. You can access these bins in the callback but you will hardly need them. This is because the alternative actions, for which the bins were invented by the author of xkeyval package, are already specified within\krddefinekeysby.do=. – Ahmed Musa Mar 05 '12 at 15:19\<keyprefix>@<family>@<keyname>. Here when both<keyprefix>and<family>are present, they make it less likely that two keys by different authors will have the same key macro, even if they had the same family. If you use only<family>and no<keyprefix>, then an existing family might easily be overwritten. – Ahmed Musa Mar 05 '12 at 17:39\krddefinekeyswill raise an error when an existing key is being redefined. So if you must not give<keyprefix>, you should consider using the starred variant of\krddefinekeysalways. – Ahmed Musa Mar 05 '12 at 17:39