Newsgroups: comp.text.tex
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!mintaka!news
From: dmjones@theory.lcs.mit.edu (David M. Jones)
Subject: Re: Help on tabular environment
In-Reply-To: glenn@network.ucsd.edu (Glenn Sueyoshi)
Message-ID: <1991Jun14.140857.25984@mintaka.lcs.mit.edu>
Sender: news@mintaka.lcs.mit.edu
Reply-To: dmjones@theory.lcs.mit.edu (David M. Jones)
Organization: Laboratory for Computer Science, MIT
References: <009499D5.177367A0.6104@Niord.SHSU.edu> <5434@network.ucsd.edu>
Date: Fri, 14 Jun 91 14:08:57 GMT
Lines: 79

In article <5434@network.ucsd.edu>, glenn@network (Glenn Sueyoshi) writes:

>I say qualified because while I've grabbed the files and run the test
>program and see how it should work in principal, I can't seem to get
>it to line up the column widths properly.  The documentation says
>that one should enable (uncomment out) out the \setlongtables
>command and re-run, which I have (twice), but I still get columns 
>which don't align.
>
>I'm running LaTeX 2.09 <7 December 1989> under TeX 3.0 and have the
>Mittelbach et al. font selection scheme installed.

Since I haven't seen any response to this, I'll take the liberty of
burdening the net with my analysis.

The culprit is the M&S font selection scheme.  In particular,
lfonts.new redefines \@tabclassz as follows:

   \def\@tabclassz{\ifcase \@lastchclass
          \@acolampacol \or \@ampacol \or
          \or \or \@addamp \or
          \@acolampacol \or
          \@firstampfalse \@acol \fi
    \edef\@preamble{\@preamble{%  <===== extra open curly brace
      \ifcase \@chnum
        \hfil\ignorespaces\@sharp\unskip\hfil
       \or \ignorespaces\@sharp\unskip\hfil
       \or \hfil\hskip\z@
          \ignorespaces\@sharp\unskip\fi}}}%  <======= extra close curly

(Note that this is the only change in \@tabclassz.)

As you can see, this adds an extra level of braces around each
template in the \halign \@preamble, so you get something like

    \hskip \tabcolsep {\ignorespaces \@sharp \unskip \hfil }\hskip \tabcolsep 

instead of

    \hskip \tabcolsep \ignorespaces \@sharp \unskip \hfil \hskip \tabcolsep

Now, longtable.sty counts the number of columns in a table essentially
by counting the number of \@sharp's in the preamble.  It does this by
taking the preamble apart with a macro invoked something like this:

        \macro#1\@sharp

But, since the \@sharp's are now inside braces, this fails.  The
result is that the number of columns \LT@cols is set to 0, and this
causes trouble for the \LT@blank@row command, which uses \LT@cols to
determine how many "\omit"s is should put in the blank line that is
used to measure the length of the columns in the table and store that
information in the .aux file.  The final result of this is that, e.g.,
you get

        \gdef \LT@i{\omit \kern 166pt}

instead of

        \gdef \LT@i{\omit \kern 166pt&\omit \kern 42pt&\omit \kern 34pt}

in the .aux file.

I'm not sure what the correct solution is, since I don't know why the
extra level of braces was added to \@tabclassz (I don't have a copy of
lfonts.doc).  I don't know what would happen if we simply changed the
definition back to the original one, but I assume something would go
wrong somewhere.  The alternative seems to be to redefine the column
counting routine to handle the new type of preamble, but I'm not quite
sure how to do that.  (Perhaps we should just redefine \@mkpream to
count the columns while it is constructing the preamble?)  Any wizards
have any ideas?  Would anyone care to check my analysis?  I'll be glad
to provide more details to any interested party.
------------------------------------------------------------------------------
David M. Jones                                 |"What we've just seen's
ARPANET: dmjones@athena.mit.edu                | A pathetic display
UUCP: ...!mit-eddie!mit-athena!dmjones         | By a man who's
USmail: 3 Ames Street; Cambridge, MA 02139     | Beginning to crack."
------------------------------------------------------------------------------
