10

What is the long version of \edef, \xdef, \protected@edef ... Do they work when we add a \long in front of them, like for \def :

\long\def\macom{...} 
\long\edef\macom{...} 
\long\gdef\macom{...} 
\long\xdef\macom{...} 
\long\protected@edef\macom{...} 
  • 3
    The last one won't work (the \long prefix would incorrectly apply itself to the first token of the definition of \protected@edef The definition of \protected@edef is only 5 lines, it would be easy to make a long version if it were needed, but it's never been needed so far:-) All the others are OK. – David Carlisle Jun 19 '12 at 15:12
  • 2
    As written, none of the definitions really need to be long as there are no arguments. The only way this will show up is if you are doing an \ifx test against another long macro. What is the context? – Joseph Wright Jun 19 '12 at 15:25
12

\long can go in front of \def, \gdef, \edef and \xdef, so the first four constructions work. However the expansion of \protected@edef is

\let\@@protect\protect
\let\protect\@unexpandable@protect
\afterassignment\restore@protect
\edef

so a \long in front of \protected@edef would give an error.

\def\protected@longedef{%
  \let\@@protect\protect
  \let\protect\@unexpandable@protect
  \afterassignment\restore@protect
  \long\edef}

Why would you need this is not clear, but here it is.

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.