[texhax] unexplained space

Oleg Katsitadze olegkat at gmail.com
Wed May 9 11:50:02 CEST 2007


On Tue, May 08, 2007 at 03:59:36PM -0500, Karl Berry wrote:
> when TeX is looking for a <space>, the code following is
> expandable (\if..., in that case), and it's happening inside an
> alignment template.

One very common situation when TeX is looking for a <space> is when it
delimits a number.  For example, when running the following through
tex:

  \count0=1%
  2
  \showthe\count0
  \bye

you'd get:

  > 12.
  l.3 \showthe\count0

Hence another rule of thumb:  always leave a <space> after a number
(or put \relax there).  This is particularly nasty when a number comes
before a macro parameter, because you never know what will be in the
parameter:

  \count0=1%
  #1

BTW, watch out for a similar caveat with glues:

  \vskip 1pt
  #1

If #1 happens to start with `plus' or `minus', TeX will either throw
`Missing number' at you (if a <dimen> does not follow `plus' or
`minus'), or add the stretching/shrinking to \vskip.  \relax is your
friend here, too (or else, always specify `plus 0pt minus 0pt').

Best,
Oleg


More information about the texhax mailing list