\edef does not work with \protect\protect, or “self-protected” — meaning that
they have \protect built in to their definition in some
way. Self-protected commands, and fragile commands with
\protection are only robust in a context where the \protect
mechanism is properly handled. The body of an \edef definition
doesn’t handle \protect properly, since \edef is a TeX
primitive rather than a LaTeX command.
This problem is resolved by a LaTeX internal command
\protected@edef, which does the job of \edef while keeping the
\protect mechanism working. There’s a corresponding
\protected@xdef which does the job of \xdef.
Of course, these commands need to be tended carefully, since they’re
internal: see ’@’ in control sequence names.
Go to previous question, or next question
Go to FAQ home.
URL for this question: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=edef
Comments, suggestions, or error reports? - see “how to improve the FAQ”.
This is FAQ version 3.27, released on 2013-06-07.