I'm currently using LaTeX to make a poster, which is all going very nicely. However for each of the seven boxes on the poster, I've got to pass eight arguments which may change in the future. I thought a sensible thing to do would be:


and then:


However this throws out an error

Package xkeyval Error: blabla (the contents of \details) undefined in families posterbox.

I have checked that replacing the \details with the contents of the custom command works fine!

Any ideas on how to solve this?

  • 1
    Welcome to TeX.SE. If the answer below does not solve your issue, keep in mind that while code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. This will also help to ensure that the proposed solution actually works for you. Jan 29 '12 at 0:45
  • 1
    @craq the original fails because xkeyval (following keyval) goes to some lengths not to expand macros in its argument so that you can have a setting such as zzz=\wibble and the value of the value of the key is \wibble not the value of \wibble prematurely expanded while parsing the key list. Nov 21 '14 at 11:35
  • @craq Are you asking why the code in the question failed or why Dan's initial attempt to implement the answer given didn't work? (But I thought the latter was addressed in the comments.)
    – cfr
    Nov 22 '14 at 23:37
  • @cfr I was asking about the initial attempt. I agree, @DavidCarlisle's comment explains that nicely. I assume that there is no workaround, such as double-escaping e.g. zzz=\\wibble in the same vein as nested arguments ##1 or like shell scripts?
    – craq
    Nov 24 '14 at 8:45
  • @craq you can pre-expand the argument see the added example (below the line) in my answer using \edef Nov 24 '14 at 9:53

one way is to invert the call structure:




If you do not want to do that you need to expand \details before passing the keyval optional argument to the macro, one way is


  • Thanks for the reply, but unfortunately this doesn't seem to work. I think it might be due to head1 and head2 being custom colours (set with \definecolor)?
    – Dan
    Jan 29 '12 at 0:09
  • @Dan David had missed an open brace. Apart from that, his code should do exactly what you seem to be asking for. Since you are not telling us what packages you are loading, it is impossible to know what "custom colours set with \definecolor" are (also, that would probably be a different question than this one). Jan 29 '12 at 0:14

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.