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 = diff --git a/test/command/9350.md b/test/command/9350.md new file mode 100644 index 000000000..d641f8b76 --- /dev/null +++ b/test/command/9350.md @@ -0,0 +1,12 @@ +``` +% pandoc -f html -t latex +
+^D +\begin{longtable}[]{@{}l@{}} +\toprule\noalign{} +\endhead +\bottomrule\noalign{} +\endlastfoot + \\ +\end{longtable} +```