[texhax] little table within table cell

Oleg Katsitadze olegkat at gmail.com
Wed Jun 14 14:54:01 CEST 2006


On Wed, Jun 14, 2006 at 04:39:47AM -0400, Geoffrey Knauth wrote:
> \valign{\strut#&#\cr Sat&5/27\cr}

Why are you using \valign?  It puts the stuff into the
main vertical list after the current box, that's why it
takes up the whole line.

The simplest solution for your problem is to just split one
`visual' cell into two subcells, the upper one containing
`Sat' and the lower `5/27'.  If your table uses rules, just
omit the horizontal rule between these two cells and box the
two cells together, so they will look like one cell.

If somehow you need these to be in a single cell, try
something like this:

\halign{
    #\cr
    \vbox{\hbox to 2em{\hss\strut Sat\hss}
          \hbox to 2em{\hss\strut 5/27\hss}}\cr
}

Replace 2em by whatever is appropriate, and probably define
the whole thing as a macro.

If you still want to use \halign inside another \halign,
just put the internal \halign into a \vbox:

\halign{
  #\cr
  \vbox{\halign{
    \hfil\strut#\hfil\cr
    Sat\cr
    5/27\cr
  }}\cr
}

Even better, isolate the internal \halign inside a macro, to
avoid confusing yourself.  Put it in a \vbox and double the
#'s, like this:

\def\t{%
  \vbox{\halign{%
    \hfil\strut##\hfil\cr
    Sat\cr
    5/27\cr
  }}%
}

\halign{
  #\cr
  \t\cr
}

HTH,
Oleg


More information about the texhax mailing list