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) – David Carlisle Mar 2 '14 at 18:59

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}? – Magnar Myrtveit Mar 2 '14 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. – David Carlisle Mar 2 '14 at 19:26

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.