[texhax] A sign-change puzzle

pierre.mackay pierre.mackay at comcast.net
Sat Dec 9 16:49:56 CET 2006


I am currently working on a book that requires a lot of letterspacing
in uppercase and some numeric text.  I use a tail-recursion macro :

\def\[#1]{\lsp#1\empty\psl}%
\def\lsp#1#2\psl{\ifx#1\empty
\else#1\kern\letterspacing\lsp#2\psl\fi}

NOTE: \[...] works just fine for me, because there is hardly ever any
   mathematics in anything I set.

This simple macro works over about 25 letters at a time without filling
up any of TeX's arrays.  It has been a reliable workhorse until now,
because I never before had to letterspace numerals.  As soon as I
tried it with numerals, I found that the kerns were all set negative.
The cure was simple: do the uppercase letters and numbers separately,
but I am baffled in trying to figure out what is changing the sign on
the value in \letterspacing.

\letterspacing=0.15em  % That is "track 30" in the nether world
\[THIS~IS~LETTERSPACED] % The ~ is needed because the macro
                                  % doesn't even see spaces. It is also 
useful as a
                                  % handle for adjusting interword space 
in letterspaced text

\kern(some visually acceptable amount between letters and numerals)

\letterspacing=-0.15em % set up negative value for numerals, but why???
\[12345]

Results:

T H I S  I S  L E T T E R S P A C E D      1 2 3 4 5

Can anyone suggest to me why this sign change is necessary?

Pierre MacKay


More information about the texhax mailing list