TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For a key keya defined by


the keyval package uses

  \xdef\@gtempa{\expandafter\noexpand\csname KV@#1@#2\endcsname{\the\toks@}}%
  \expandafter\let\csname KV@#1@#2@default\endcsname\@gtempa
  \expandafter\def\csname KV@#1@#2\endcsname##1{#4}%

to define the default value as


This style of defining the default value is called the standard format by the xkeyval package. Packages such fancyvrb don't adhere to this standard. The xkeyval package says that such packages abuse the default-value format.

I have always wondered why the keyval package chose to define the default value of a key in this way, instead of the apparently cheaper approach of storing the default value in a macro like


Without eTeX this should actually be


or something similar.

share|improve this question
Where is the question? Why don't you accept any of your questions. – Marco Daniel Feb 5 '12 at 0:07
Where is the question? Wait for David Carlisle! Please I have clicked on the 'accept' mark/button but the red warning will not disappear. – Ahmed Musa Feb 5 '12 at 0:13
@AhmedMusa: Be sure to not to close the page too early after clicking (give it a few seconds). If you have JavaScript disabled or blocked, enable it. – Andrey Vihrov Feb 5 '12 at 0:23
Even though you've accepted this question, here's a reference for future use: How do you accept an answer? – Werner Feb 5 '12 at 4:22
Werner: Thanks. I got it right eventually. I think Andrey Vihrov's suggestion was the clincher. – Ahmed Musa Feb 5 '12 at 17:38
up vote 6 down vote accepted

"Why" answers are always hard to answer, especially decades after the fact. I think that the original motivating examples that I was trying to pull into a common key-value system included cases where the "default" action didn't correspond directly to passing a value to a key, invoking a separate ..@default command name means that the default case can be defined to do essentially anything.

share|improve this answer
David: Thanks. This rather trivial question has led me to something in ltxkeys package. – Ahmed Musa Feb 5 '12 at 17:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.