I have created a new command that takes beamer-arguments (<...>), but I'm not able to pass them on. I suppose it's a \expandafter problem. Does anyone have a clue?


\pgfkeys{/mypgf/.cd, arg/.store in = \arg}

    \pgfkeys{/mypgf/.cd, #1}

        \def\options{} % set options to something useful based on #1

        % This works:

        % But not when I try to add the beamer argument:



  • 1
    do you intend the macro to insert a paragraph break before image? (all the white space in the definition has an effect) Mar 2, 2014 at 18:59

1 Answer 1


the first \expandafter will expand the first token (only) of #3 but that is < so nothing expands. I think you intended

  • Perfect! Do you know why it isn't possible to do \expandafter{\includegraphics#3}\expandafter[\options]{#2}? Mar 2, 2014 at 19:19
  • 1
    \expandafter{\includegraphics expands the first token after the { (which would be \includegraphics so it is effectively a no-op as { is not expandable so it is the same as {\includegraphics either way \includegraphics is the first thing to expand. Mar 2, 2014 at 19:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .