git.iko.soy/typeable/pandoc
on master help sign in
LaTeX tables: more space btw lines, top-align cells.

Closes #271.

commit09479ba7b2ad2b39fe05af70ae88e5bfed913c8d authorJohn MacFarlane <jgm@berkeley.edu> dateSun 10 Jul 2011, 09:09 (15 years ago) parentcda9d2a
1 file changed+4−3
src/Text/Pandoc/Writers/LaTeX.hs+4−3
src/Text/Pandoc/Writers/LaTeX.hs+4−3
@@ -271,7 +271,8 @@ blockToLaTeX (Header level lst) = do
271271blockToLaTeX (Table caption aligns widths heads rows) = do
272272 headers <- if all null heads
273273 then return empty
274− else liftM ($$ "\\hline") $ (tableRowToLaTeX widths) heads
274+ else liftM ($$ "\\hline\\noalign{\\smallskip}")
275+ $ (tableRowToLaTeX widths) heads
275276 captionText <- inlineListToLaTeX $ deVerb caption
276277 rows' <- mapM (tableRowToLaTeX widths) rows
277278 let colDescriptors = concat $ zipWith toColDescriptor widths aligns
@@ -306,10 +307,10 @@ tableRowToLaTeX :: [Double] -> [[Block]] -> State WriterState Doc
306307tableRowToLaTeX widths cols = do
307308 renderedCells <- mapM blockListToLaTeX cols
308309 let toCell 0 c = c
309− toCell w c = "\\parbox{" <> text (printf "%.2f" w) <>
310+ toCell w c = "\\parbox[t]{" <> text (printf "%.2f" w) <>
310311 "\\columnwidth}{" <> c <> cr <> "}"
311312 let cells = zipWith toCell widths renderedCells
312− return $ (hcat $ intersperse (" & ") cells) <> "\\\\"
313+ return $ (hcat $ intersperse (" & ") cells) <> "\\\\\\noalign{\\medskip}"
313314
314315listItemToLaTeX :: [Block] -> State WriterState Doc
315316listItemToLaTeX lst = blockListToLaTeX lst >>= return . (text "\\item" $$) .