Sorry, this must be a very beginner's thing, but I cannot figure out how to get the macro expanded in the loop. I tried expandafter, csname, but don't get it working.

\define@cmdkey[mini]{test}{keyA}       {}% 
\define@cmdkey[mini]{test}{keyB}       {}%
\define@cmdkey[mini]{test}{keyC}       {}%
    \cmdmini@test@keyA% these work ok
    \foreach \i in {A,B,C}{%
        \i :%
        \cmdmini@test@key{\i}% This is the line that goes wrong
    keyA={this is key A},%
    keyB={this is key B},%
    keyC={this is key C},%
  • You need \csname cmdmini@test@key\i\endcsname. The \i is not an argument but part of the command name. – Ulrike Fischer Mar 17 '16 at 16:10
  • I would never have guessed that, but I understand more about (end)csname now. Thank you. – mauricev Mar 17 '16 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.