'`\edef` does not work with `\protect`'

  • latex
  • macros

Robust LaTeX commands are either “naturally robust” - meaning that they never need \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.

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

Creative Commons Lizenzvertrag Edit this page Old revisions Sitemap Backlinks RSS feed Impressum Flattr this