summaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2024-01-20 10:19:03 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2024-01-20 10:19:32 -0800
commitf43ffabd3c598f7154cd101069e7e77947f5676d (patch)
tree8a0f9977d136e3ff4899074f53dfb3fa0958920f /src/Text
parentc2f7f5c63fe223f07033cfc686cb258508970301 (diff)
LaTeX writer: create valid table even when table is empty.
Closes #9350.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX/Table.hs14
1 files changed, 8 insertions, 6 deletions
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 =