Section "11.4 Robust Commands and \protect" of source2e.pdf (File d: ltdefns.dtx Date: 2020/02/27 Version v1.5g) says that \protect can have one of five possible "values" but lists only four of them:

  1. \relax
  2. \string
  3. \noexpand
  4. \@unexpandable@protect\noexpand\protect\noexpand

What is the fifth/not listed value?

Why is it not listed?


Update The documentation has been fixed for the next release to say four, only took 26 years after the code change to bring the documentation into line.

Just below the quoted line you see

% \changes{1.1c}{1994/05/18}
%     {(ASAJ) Renamed the commands, and removed
%       one which is no longer needed.}

which explains why the list is one short, now I'm trying to recall what that was. I have a suspicion it was \noexpand\noexpand\noexpand but I'd need to check...

Yes the LaTeX2.09 source (latex.tex) uses \noexpand\noexpand\noexpand in for example

\def\label#1{\@bsphack\if@filesw {\let\thepage\relax
  • It looks like it was redefined to \@empty in \patterns and \hyphenation at some point, but that appears to have been commented out (§20.4.2). – Don Hosek Sep 24 '20 at 23:36
  • I think \noexpand\noexpand\noexpand was replaced with \noexpand\protect\noexpand – Don Hosek Sep 24 '20 at 23:37
  • 1
    means we should change the docu to say 4 – Frank Mittelbach Sep 25 '20 at 7:19

I have source2e.pdf Date: 2004/02/20 Version 1.3g in my archive.

It says:

The method LaTeX uses for making fragile commands robust is to precede them with \protect. This can have one of five possible values:

  • \relax, for normal typesetting. So \protect\foo will execute \foo.
  • \string, for writing to the screen. So \protect\foo will write \foo.
  • \noexpand, for writing to a file. So \protect\foo will write \foo followed by a space.
  • \@unexpandable@protect, for writing a moving argument to a file. So \protect\foo will write \protect\foo followed by a space. This value is also used inside \edefs, \marks and other commands which evaluate their arguments fully.
  • \@unexpandable@noexpand, for performing a deferred write inside an \edef. So \protect\foo will write \foo followed by a space. If you want \protect\foo to be written, you should use \@unexpandable@protect. (Removed as never used).

These commands are used for setting \protect inside \edefs.
192 \def\@unexpandable@protect{\noexpand\protect\noexpand}
193 %\def\@unexpandable@noexpand{\noexpand\noexpand\noexpand}

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.