🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #898

Re: Trouble with \halign and \multispan

#898
From: David Carlisle
Date: Wed, 05 Aug 1992 10:50
65 lines
3106 bytes
In article <1992Aug5.020826.11539@organpipe.uug.arizona.edu> mjm@spekl.as.arizona.edu (Mark McCaughrean) writes:


   I'm having trouble getting equally spaced aligned columns using
   \halign in UNIX TeX 3.14t3. As soon as I use \multispan to write 
   a title, the last column always ends up padded with more space.

   \tabskip=0pt plus 1fil
   \halign to\hsize{\hfil#\hfil&\hfil#\hfil&\hfil#\hfil&\hfil#\hfil\cr
   0.00 & 0.78 & 1.83 & 1.48 \cr
   0.00 & 0.12 & 0.73 & 0.46 \cr
   0.00 & 0.10 & 0.67 & 0.40 \cr}

   \halign to\hsize{\hfil#\hfil&\hfil#\hfil&\hfil#\hfil&\hfil#\hfil\cr
   \multispan4\hfil This is the same titled using multispan \hfil\cr
   0.00 & 0.78 & 1.83 & 1.48 \cr
   0.00 & 0.12 & 0.73 & 0.46 \cr
   0.00 & 0.10 & 0.67 & 0.40 \cr}

   \halign to\hsize{\hfil#\hfil&\hfil#\hfil&\hfil#\hfil&\hfil#\hfil\cr
   \multispan4\hfil This is the same table again but with an even longer
		    title just to make the point yet more obvious \hfil\cr
   0.00 & 0.78 & 1.83 & 1.48 \cr
   0.00 & 0.12 & 0.73 & 0.46 \cr
   0.00 & 0.10 & 0.67 & 0.40 \cr}

If a \spanned entry is wider than the natural widths of the columns it
is spanning, then the *last*  column is widened to make room for it.
The space is *not* distributed over all the spaned columns.

The solution is to make (TeX think that) the spanned entry is not very
wide. \hidewidth is one way of doing this:

 
\tabskip=0pt plus 1fil
\halign to\hsize{\hfil#\hfil&\hfil#\hfil&\hfil#\hfil&\hfil#\hfil\cr
0.00 & 0.78 & 1.83 & 1.48 \cr
0.00 & 0.12 & 0.73 & 0.46 \cr
0.00 & 0.10 & 0.67 & 0.40 \cr}
 
\halign to\hsize{\hfil#\hfil&\hfil#\hfil&\hfil#\hfil&\hfil#\hfil\cr
\multispan4\hidewidth This is the same titled using multispan \hidewidth\cr
0.00 & 0.78 & 1.83 & 1.48 \cr
0.00 & 0.12 & 0.73 & 0.46 \cr
0.00 & 0.10 & 0.67 & 0.40 \cr}
 
\halign to\hsize{\hfil#\hfil&\hfil#\hfil&\hfil#\hfil&\hfil#\hfil\cr
\multispan4\hidewidth This is the same table again but with an even longer
                 title just to make the point yet more obvious \hidewidth\cr
0.00 & 0.78 & 1.83 & 1.48 \cr
0.00 & 0.12 & 0.73 & 0.46 \cr
0.00 & 0.10 & 0.67 & 0.40 \cr}

\bye

--
                           David Carlisle
                                    JANET: carlisle@uk.ac.man.cs

                                    Computer Science Department
                                    Manchester University
                                    Oxford Road
                                    Manchester
                                    England
                                    M13 9PL
Technical Details
Message-ID: <CARLISLE.92Aug5115057@r8d.cs.man.ac.uk>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!mucs!m1!carlisle
References: <1992Aug5.020826.11539@organpipe.uug.arizona.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!uknet!mucs!m1!carlisle
From: carlisle@cs.man.ac.uk (David Carlisle)
Newsgroups: comp.text.tex
Subject: Re: Trouble with \halign and \multispan
Message-ID: <CARLISLE.92Aug5115057@r8d.cs.man.ac.uk>
Date: 5 Aug 92 10:50:57 GMT
References: <1992Aug5.020826.11539@organpipe.uug.arizona.edu>
Sender: news@cs.man.ac.uk
Organization: Department of Computer Science, University of Manchester
Lines: 65
In-reply-to: mjm@spekl.as.arizona.edu's message of 5 Aug 92 02:08:26 GMT