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] [(#f) null]
[(top) '((valign "top"))] [(top) '((valign "top"))]
[(baseline) '((valign "baseline"))] [(baseline) '((valign "baseline"))]
[(center) '((valign "center"))]
[(bottom) '((valign "bottom"))]) [(bottom) '((valign "bottom"))])
,@(if (string? st) ,@(if (string? st)
`([class ,st]) `([class ,st])

View File

@ -302,12 +302,12 @@
(let ([flows (car flowss)] (let ([flows (car flowss)]
[row-style (car row-styles)]) [row-style (car row-styles)])
(let loop ([flows flows] (let loop ([flows flows]
[col-v-styles (and (list? row-style) [col-v-styles (or (and (list? row-style)
(or (let ([p (assoc 'valignment row-style)]) (let ([p (assoc 'valignment row-style)])
(and p (cdr p))) (and p (cdr p))))
(let ([p (and (list? (table-style t)) (let ([p (and (list? (table-style t))
(assoc 'valignment (table-style t)))]) (assoc 'valignment (table-style t)))])
(and p (cdr p)))))]) (and p (cdr p))))])
(unless (null? flows) (unless (null? flows)
(when index? (printf "\\item ")) (when index? (printf "\\item "))
(unless (eq? 'cont (car flows)) (unless (eq? 'cont (car flows))
@ -347,17 +347,20 @@
(printf "\\begin{tabular}~a{@{}l@{}}\n" (printf "\\begin{tabular}~a{@{}l@{}}\n"
(cond (cond
[(eq? vstyle 'top) "[t]"] [(eq? vstyle 'top) "[t]"]
[(eq? vstyle 'center) "[c]"]
[else ""]))) [else ""])))
(let loop ([ps (flow-paragraphs p)]) (let loop ([ps (flow-paragraphs p)])
(cond (cond
[(null? ps) (void)] [(null? ps) (void)]
[else [else
(let ([minipage? (not (or (paragraph? (car ps)) (let ([minipage? (or (not (or (paragraph? (car ps))
(table? (car ps))))]) (table? (car ps))))
(eq? vstyle 'center))])
(when minipage? (when minipage?
(printf "\\begin{minipage}~a{~a\\linewidth}\n" (printf "\\begin{minipage}~a{~a\\linewidth}\n"
(cond (cond
[(eq? vstyle 'top) "[t]"] [(eq? vstyle 'top) "[t]"]
[(eq? vstyle 'center) "[c]"]
[else ""]) [else ""])
(/ 1.0 twidth))) (/ 1.0 twidth)))
(render-block (car ps) part ri #f) (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 @item{@scheme['valignment] to a list of symbols and
@scheme[#f]s (one for each column); each symbol can be @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, @item{@scheme['row-styles] to a list of association lists,
one for each row in the table. Each of these nested one for each row in the table. Each of these nested