[tex-k] Error in TeXbook: Trailing tabs don't typeset

Evan Aad oddeveneven at gmail.com
Fri Sep 1 11:01:29 CEST 2017


I will save y'all some trouble (or some fun, depending on your point
of view), and just state where the bug is.

The bug was perpetrated by Peter Breitenlohner on Thu Oct 16 20:39:27
1997 by Olaf Weber (citing Peter Breitenlohner), by reimplementing
Knuth's 'input_ln' function. The re-implementation is explained in the
code thus: "We define |input_ln| in C, for efficiency." But under the
guise of 'efficiency', Weber/Breitenlohner snuck in an alteration to
the function's semantics, which contradicts Knuth's specifications in
both the TeXbook and the TeX source code.

The affected files are

texk/web2c/tex.ch ... function input_ln
exk/web2c/lib/texmfmp.c ... input_line
texk/kpathsea/c-ctype.h ... isblank

Luckily, this is very easy to fix: replace the test "ISBLANK
(buffer[last - 1])" in input_line by "(buffer[last - 1]== ' ')".

On Fri, Sep 1, 2017 at 11:39 AM, Evan Aad <oddeveneven at gmail.com> wrote:
>
> The first line, which sets <tab>'s catcode to 12 undoes Plain TeX's
> settings, and the <tab> no longer acts like a blank space.
>
> On Fri, Sep 1, 2017 at 11:17 AM, Julian Gilbey <julian at d-and-j.net> wrote:
> >
> > On Wed, Aug 30, 2017 at 07:55:55PM +0300, Evan Aad wrote:
> > > I think I found an error in the TeXbook. Please vet.
> > >
> > > Consider the following Plain TeX manuscript
> > >
> > > ---
> > > \catcode9=12\relax% ASCII 9 is tab
> > > .\ \ .\par%
> > > .
> > > .%
> > > \bye
> > >
> > > [...]
> > > Observe that there seem to be two spaces between the dots on the first
> > > line, but only one space between the dots on the second line.
> > >
> > > However, based on the TeXbook, I'd expect there two be two spaces
> > > between the dots on the second line too: one for the tab, and one for
> > > the carriage-return at the end of the line.
> >
> > This is not correct: "Plain TeX makes <tab> act like a blank space."
> > says the TeXbook (page 45), so you have a blank space, and TeX enters
> > state S (skipping blanks).  It now reaches the end-of-line, and "if
> > TeX is in state S (skipping blanks), the end-of-line character is
> > simply dropped." (page 46).  So all that you end up with is a single
> > space character, as you observed.
> >
> >    Julian
>


More information about the tex-k mailing list