TeX/edef
From Wikibooks, the open-content textbooks collection
< TeX
[edit] Synopsis
\edef <command> {<replacement-text>}
[edit] Description
\edef is similar to \def in that it allows you to define new macros or replace an existing macro. The significant defining difference between \edef and \def is that \edef expands macros, rather than executing them. This difference allows \edef to be used to append new information to a macro, for example:
\edef\@test{A}
\edef\@test{\@test B}
\edef\@test{\@test C}
\@test
results in the output "ABC". Attempting to do this example with \def instead will result in the error "TeX capacity exceeded, sorry". This behavior can be useful in loops that compile a string of information, but do not end up outputting the information directly.