From bd1917602658467ca2335244ea97f0b39f4f680a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 20 Nov 2016 17:01:51 +0100 Subject: LaTeX writer: ensure that simple tables have simple cells. If cells contain more than a single Plain or Para, then we need to set nonzero widths and put contents into minipages. Closes #2666. --- src/Text/Pandoc/Writers/LaTeX.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc/Writers') diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 0fd8cdd8c..19f29ceeb 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -635,7 +635,14 @@ tableRowToLaTeX header aligns widths cols = do -- scale factor compensates for extra space between columns -- so the whole table isn't larger than columnwidth let scaleFactor = 0.97 ** fromIntegral (length aligns) - let widths' = map (scaleFactor *) widths + let isSimple [Plain _] = True + isSimple [Para _] = True + isSimple _ = False + -- simple tables have to have simple cells: + let widths' = if not (all isSimple cols) + then replicate (length aligns) + (0.97 / fromIntegral (length aligns)) + else map (scaleFactor *) widths cells <- mapM (tableCellToLaTeX header) $ zip3 widths' aligns cols return $ hsep (intersperse "&" cells) <> "\\tabularnewline" -- cgit v1.2.3