aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2011-07-10 09:09:51 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2011-07-10 12:33:34 -0700
commit09479ba7b2ad2b39fe05af70ae88e5bfed913c8d (patch)
tree3157b7903c3030a2120eb0d96e32be59518cc3c5 /src/Text/Pandoc
parentcda9d2a655f29f0b6c92c2a0e2c4a13010bbfba8 (diff)
downloadpandoc-09479ba7b2ad2b39fe05af70ae88e5bfed913c8d.tar.gz
LaTeX tables: more space btw lines, top-align cells.
Closes #271.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 1a15adf7a..f5003de0d 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -271,7 +271,8 @@ blockToLaTeX (Header level lst) = do
blockToLaTeX (Table caption aligns widths heads rows) = do
headers <- if all null heads
then return empty
- else liftM ($$ "\\hline") $ (tableRowToLaTeX widths) heads
+ else liftM ($$ "\\hline\\noalign{\\smallskip}")
+ $ (tableRowToLaTeX widths) heads
captionText <- inlineListToLaTeX $ deVerb caption
rows' <- mapM (tableRowToLaTeX widths) rows
let colDescriptors = concat $ zipWith toColDescriptor widths aligns
@@ -306,10 +307,10 @@ tableRowToLaTeX :: [Double] -> [[Block]] -> State WriterState Doc
tableRowToLaTeX widths cols = do
renderedCells <- mapM blockListToLaTeX cols
let toCell 0 c = c
- toCell w c = "\\parbox{" <> text (printf "%.2f" w) <>
+ toCell w c = "\\parbox[t]{" <> text (printf "%.2f" w) <>
"\\columnwidth}{" <> c <> cr <> "}"
let cells = zipWith toCell widths renderedCells
- return $ (hcat $ intersperse (" & ") cells) <> "\\\\"
+ return $ (hcat $ intersperse (" & ") cells) <> "\\\\\\noalign{\\medskip}"
listItemToLaTeX :: [Block] -> State WriterState Doc
listItemToLaTeX lst = blockListToLaTeX lst >>= return . (text "\\item" $$) .