8

Possible Duplicate:
Are we inside an edef?

I've defined a macro that changes its behaviour depending on the next character, so it uses \@ifnextchar. This makes it behave badly inside things like \edefs. I'd like to define a "failsafe" behaviour, something like:

\ifExpansionOnly
  \doSomethingSensibleButSafe
\else
  \doTheRealThing
\fi

Is that possible to detect? It feels like something to do with "fragile" and "robust" commands, but my experimental skills are failing me here.

(Edit: removed motivation from using hyperref; turned out the behaviour that I was seeing there was due to using \Hy@WrapperDef in the wrong place.)

Andrew Stacey
  • 153,724
  • 43
  • 389
  • 751
  • Duplicate of http://tex.stackexchange.com/q/9781/2707? – Bruno Le Floch Sep 22 '11 at 22:16
  • @BrunoLeFloch: Yes, that looks like a duplicate to me. (And Ulrich ought to have noticed that!) I'd say that this was actually a case for a merge since Ulrich's answered this one but only left a comment on yours. – Andrew Stacey Sep 23 '11 at 06:50

0 Answers0