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

I try do define a command \tes@define@key@length. Everything work but when I use the following line:

\expandafter\setlength\csname test@#1@length\endcsname{\csname testl@#1\endcsname}%

I get an error. Here an example where I comment the special line:



%#1 Bezeichnung Länge
%#2 Defaultwert Länge
 \csxdef{test@#1}{#1 wurde definiert}
 \gdef\test@default{#2 ist der Defaultwert}
 \expandafter\newlength\csname test@#1@length\endcsname
 \expandafter\setlength\csname test@#1@length\endcsname{#2}%
%#1 option
%    \expandafter\setlength\csname test@#1@length\endcsname{\csname testl@#1\endcsname}%






\advance\test@skipabove@length by 2pt


share|improve this question
up vote 5 down vote accepted

\test@skipabove@length is not defined until you use \tes@optionlength{skipabove}{4pt}. But you use \tes@define@key@length{skipabove} without defining the length earlier.

BTW, you can simply use

\setlength{\csname test@#1@length\endcsname}{\csname testl@#1\endcsname}

without \expandafter.

share|improve this answer
thanks. Without expandafter is new for me. But the mistake is very bad – Marco Daniel Jun 11 '11 at 12:22

The error I see is that the length \test@#1@length is not yet defined when you try to set it up.

If I add \expandafter\show\csname test@#1@length\endcsname before the commented line, I get

> \test@skipabove@length=\relax
<recently read> \test@skipabove@length
share|improve this answer
thanks. I can't accept both answers ;-) – Marco Daniel Jun 11 '11 at 11:57

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.