From f43ffabd3c598f7154cd101069e7e77947f5676d Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 20 Jan 2024 10:19:03 -0800 Subject: LaTeX writer: create valid table even when table is empty. Closes #9350. --- src/Text/Pandoc/Writers/LaTeX/Table.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Writers/LaTeX/Table.hs b/src/Text/Pandoc/Writers/LaTeX/Table.hs index 702b22328..4dfe6be62 100644 --- a/src/Text/Pandoc/Writers/LaTeX/Table.hs +++ b/src/Text/Pandoc/Writers/LaTeX/Table.hs @@ -137,12 +137,14 @@ colDescriptors isSimpleTable then replicate (length specs) (1 / fromIntegral (length specs)) else map toRelWidth widths - in if defaultWidthsOnly && isSimpleTable - then hcat $ map (literal . colAlign) aligns - else (cr <>) . nest 2 . vcat . map literal $ - zipWith (toColDescriptor (length specs)) - aligns - relativeWidths + in if null aligns + then "l" -- #9350, table needs at least one column spec + else if defaultWidthsOnly && isSimpleTable + then hcat $ map (literal . colAlign) aligns + else (cr <>) . nest 2 . vcat . map literal $ + zipWith (toColDescriptor (length specs)) + aligns + relativeWidths where toColDescriptor :: Int -> Alignment -> Double -> Text toColDescriptor numcols align width = -- cgit v1.2.3