3

In this question: Automatically adding space before punctuation in old-style English texts, the accepted answer uses the following definition

\edef!{\unskip\noexpand\,\string!}

What is the difference with the apparently simpler

\def!{\thinspace\string!}

apart from the \unskip which I know is not needed if ! is inputed correctly (i.e., without space before it).

1 Answers1

4

After \def!{\thinspace\string!} the contents of ! will be exactly that, so \thinspace \string !13, and when it's fully expanded upon usage, the \string will turn !13 into !12.

On the other hand \edef!{\unskip\noexpand\,\string!} will contain \unskip \,!12, so \string will already have done its job, and the expansion of ! can't possibly lead to another !13.

Skillmon
  • 60,462
  • If I understand correctly, there are equivalent when used in a text but the one using edef "precompiles" the result while the one using def computes it on the fly? –  Oct 03 '21 at 17:38
  • Thanks for your answer –  Oct 03 '21 at 17:38
  • @Laravel yes, one could say that (as well as the other subtle difference of \unskip and \; vs \thinspace). – Skillmon Oct 03 '21 at 19:52