I'm trying to pick something out of a list that has been passed from some package options by kvoptions, but docsvlist doesn't appear to be recognising the commas.

I suspect this may be something to do with the Knuth "mouth and stomach" paradigm, but I'm not enough of a TeXnician to understand why, nor how to do it correctly. Can someone explain what's going on?

Here's my MWE:


\csdef{xferret}{}      % This is what I want to extract
    \PackageWarning{testx}{Processing #1}
            \PackageWarning{testx}{##1 not selected}


\usepackage[refnames={rat, ferret, 1.0, mole}]{testx}
\testtag{rat, ferret, 1.0, mole}

The first \vtag (set in the package) produces "(None)"

The second \vtag produces "ferret"

in the log, we have this:

(from the package):

Package testx Warning: Processing rat, ferret, 1.0, mole on input line 22.
Package testx Warning: rat, ferret, 1.0, mole not selected on input line 22.

(from the call in the document body)

Package testx Warning: Processing rat, ferret, 1.0, mole on input line 5.
Package testx Warning: rat not selected on input line 5.

1 Answer 1


This is a classic expansion issue. What happens is that


passes \test@refnames exactly as written. In writing to the log, this is fully-expanded by TeX, so you see what you expect. However


sees \test@refnames as #1, with no commas. So you need to expand \test@refnames correctly. Depending on other uses, either to


at point of use or


in the internal macro (but not both!). In either case, what happens here is that TeX will follow the \expandafter to convert \test@refnames into it's content before expanding the processing macro.

  • Joseph, thank you very much. \expandafter\docsvlist\expandafter{#1} fixes it nicely. Aug 28, 2011 at 12:18

Your Answer

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

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