I am a little bit puzzeled. I want to use a macro as input for the hyperref ChoiceMenu. But i got no clue how to do.

What i do:

\newcommand{\namea}{name1, name2}
\ChoiceMenu[combo, name=MyInternallabel]{MyprintedLabel}{\namea}

What i get:

The concatenated string "name1 , name2" as the only option of choice.

What i want:

The same behavior as

\ChoiceMenu[combo, name=MyInternallabel]{MyprintedLabel}{name1, name2}
New contributor
Robert Maucher is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • Welcome to TeX.SX! Please provide complete MWE for us to examine. – schtandard 2 days ago
  • The problem is that \ChoiceMenu doesn't expect that it's argument will be in a macro, so it doesn't try to expand it. A work-around would be \begingroup\edef\x{\endgroup\unexpanded{\ChoiceMenu[combo, name=MyInternallabel]{MyprintedLabel}}{\namea}}\x, but this is not really the best idea. An example document would help to give you a better option. – Phelype Oleinik 2 days ago
  • Thanks @PhelypeOleinik it works like a charm. – Robert Maucher 2 days ago
  • i will uplaod a example document later this day. – Robert Maucher 2 days ago
  • Without memory consuming temporary macros like \x whenever calling \ChoiceMenu: \newcommand\PassFirstToSecond[2]{#2{#1}} ... \expandafter\PassFirstToSecond\expandafter{\namea}{\ChoiceMenu[combo, name=MyInternallabel]{MyprintedLabel}} – Ulrich Diez yesterday

Your Answer

Robert Maucher is a new contributor. Be nice, and check out our Code of Conduct.

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.