add center valignment for table cells

svn: r14089

original commit: 6ee7b0379cda92726ac8d1b51a4d7ec704774b1c
This commit is contained in:
Matthew Flatt 2009-03-13 16:08:06 +00:00
parent 4672f9b344
commit 7d488fa96b
3 changed files with 14 additions and 9 deletions

View File

@ -1076,6 +1076,7 @@
[(#f) null]
[(top) '((valign "top"))]
[(baseline) '((valign "baseline"))]
[(center) '((valign "center"))]
[(bottom) '((valign "bottom"))])
,@(if (string? st)
`([class ,st])

View File

@ -302,12 +302,12 @@
(let ([flows (car flowss)]
[row-style (car row-styles)])
(let loop ([flows flows]
[col-v-styles (and (list? row-style)
(or (let ([p (assoc 'valignment row-style)])
(and p (cdr p)))
(let ([p (and (list? (table-style t))
(assoc 'valignment (table-style t)))])
(and p (cdr p)))))])
[col-v-styles (or (and (list? row-style)
(let ([p (assoc 'valignment row-style)])
(and p (cdr p))))
(let ([p (and (list? (table-style t))
(assoc 'valignment (table-style t)))])
(and p (cdr p))))])
(unless (null? flows)
(when index? (printf "\\item "))
(unless (eq? 'cont (car flows))
@ -347,17 +347,20 @@
(printf "\\begin{tabular}~a{@{}l@{}}\n"
(cond
[(eq? vstyle 'top) "[t]"]
[(eq? vstyle 'center) "[c]"]
[else ""])))
(let loop ([ps (flow-paragraphs p)])
(cond
[(null? ps) (void)]
[else
(let ([minipage? (not (or (paragraph? (car ps))
(table? (car ps))))])
(let ([minipage? (or (not (or (paragraph? (car ps))
(table? (car ps))))
(eq? vstyle 'center))])
(when minipage?
(printf "\\begin{minipage}~a{~a\\linewidth}\n"
(cond
[(eq? vstyle 'top) "[t]"]
[(eq? vstyle 'center) "[c]"]
[else ""])
(/ 1.0 twidth)))
(render-block (car ps) part ri #f)

View File

@ -426,7 +426,8 @@ The @scheme[style] can be any of the following:
@item{@scheme['valignment] to a list of symbols and
@scheme[#f]s (one for each column); each symbol can be
@scheme['top], @scheme['baseline], or @scheme['bottom].}
@scheme['top], @scheme['baseline], @scheme['center],
or @scheme['bottom].}
@item{@scheme['row-styles] to a list of association lists,
one for each row in the table. Each of these nested