[racket-dev] scribble tables with centered cells
At Tue, 15 Jun 2010 11:01:24 -0400, Sam Tobin-Hochstadt wrote:
> I'd like to produce, with scribble, output similar to what this latex produces:
>
> \begin{tabular}{|c|c|c|}
> Header1 & Header2 & Header3
> 11 & 17 & 29
> \end{tabular}
>
> However, I can't seem to figure out how. First, how can I make the
> elements centered? There doesn't seem to be a way to control the
> generated column attributes - putting the 'center style in the
> `table-columns' style property just wraps the *entries* in \center{},
> which produces bizarre latex errors instead. Second, how can I insert
> the dividers?
Use 'center as a style property (not a style name); see below.
Better checking of style-name uses is on my list of things to improve
in Scribble.
----------------------------------------
#lang scribble/base
@(require scribble/core)
@(table
(style #f (list
(table-columns
(list
plain
(style #f '(center))
plain))))
(list (list @para{left}
@para{center}
@para{left})
(list @para{on the left}
@para{in the center}
@para{on the left})))