[racket-dev] scribble tables with centered cells

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Jun 16 11:08:47 EDT 2010

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)

  (style #f (list
               (style #f '(center))
  (list (list @para{left}
        (list @para{on the left}
              @para{in the center}
              @para{on the left})))

Posted on the dev mailing list.