[plt-scheme] scribbling - tables, definition lists

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Feb 12 06:13:02 EST 2008

On Feb 10, Geoffrey S. Knauth wrote:
> On Feb 10, 2008, at 17:44, Matthias Felleisen wrote:
> > See struct.ss. Use @make-table with lists and flows, like this:
> > @make-table['center]{
> >     @list[@list[@make-flow{@list[@t{hello} @t{world} @t{bye} @t{boy}]}
> >                     @make-flow{@list[@t{1}      @t{2}         
> > @t{3}    @t{4}]}]]}
> > OR, which is what I was about to do: define a function in your  
> > document (which is a program after all) that consumes a bunch of  
> > stuff and arranges it for you
> > @(define (table . stuff) ...)
> Thanks.  I also found exactly what I need in scribblings/guide/io.scrbl:
> @define[(twocolumn a b)
>          (make-table #f
>           (list (list (make-flow (list a))
>                       (make-flow (list (make-paragraph (list (hspace  
> 1)))))
>                       (make-flow (list b)))))]

BTW -- a quick comment about using multiple pieces of text in Scribble
syntax.  Say that you want to use such a function conveniently, with
the free text syntax.  The thing is that after a `@' the scribble
reader consumes any Scheme expression which is used in the head
position of the resulting sexpr -- and that includes scribble forms
too.  So:

  @foo{...}        --is-read-as-->  (foo "...")
  @(foo bar){...}  --is-read-as-->  ((foo bar) "...")


  @@foo{...}{...}  --is-read-as-->  ((foo "...") "...")

So if you define `twocolumn' as a curried function:

  @(define ((twocolumn . a) . b)
     (make-table #f
      (list (list (make-flow (list a))
                  (make-flow (list (make-paragraph (list (hspace 1)))))
                  (make-flow (list b))))))

You can use it similarly.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.