@@ -500,9 +500,28 @@ tableRowToLaTeX header aligns widths cols = do
500 cells <- mapM (tableCellToLaTeX header) $ zip3 widths' aligns cols
500 cells <- mapM (tableCellToLaTeX header) $ zip3 widths' aligns cols
501 return $ hsep (intersperse "&" cells) $$ "\\\\\\addlinespace"
501 return $ hsep (intersperse "&" cells) $$ "\\\\\\addlinespace"
503+-- For simple latex tables (without minipages or parboxes),
504+-- we need to go to some lengths to get line breaks working:
505+-- as LineBreak bs = \vtop{\hbox{\strut as}\hbox{\strut bs}}.
506+fixLineBreaks :: Block -> Block
507+fixLineBreaks (Para ils) = Para $ fixLineBreaks' ils
508+fixLineBreaks (Plain ils) = Plain $ fixLineBreaks' ils
511+fixLineBreaks' :: [Inline] -> [Inline]
512+fixLineBreaks' ils = case splitBy (== LineBreak) ils of
515+ chunks -> RawInline "tex" "\\vtop{" :
516+ concatMap tohbox chunks ++
517+ [RawInline "tex" "}"]
518+ where tohbox ys = RawInline "tex" "\\hbox{\\strut " : ys ++
519+ [RawInline "tex" "}"]
503tableCellToLaTeX :: Bool -> (Double, Alignment, [Block])
521tableCellToLaTeX :: Bool -> (Double, Alignment, [Block])
504 -> State WriterState Doc
522 -> State WriterState Doc
505−tableCellToLaTeX _ (0, _, blocks) = blockListToLaTeX blocks
523+tableCellToLaTeX _ (0, _, blocks) =
524+ blockListToLaTeX $ walk fixLineBreaks blocks
506tableCellToLaTeX header (width, align, blocks) = do
525tableCellToLaTeX header (width, align, blocks) = do
507 modify $ \st -> st{ stInMinipage = True, stNotes = [] }
526 modify $ \st -> st{ stInMinipage = True, stNotes = [] }
508 cellContents <- blockListToLaTeX blocks
527 cellContents <- blockListToLaTeX blocks