LaTeX writer: create valid table even when table is empty.

Closes #9350.
This commit is contained in:
John MacFarlane
2024-01-20 10:19:03 -08:00
parent c2f7f5c63f
commit f43ffabd3c
2 changed files with 20 additions and 6 deletions
+8 -6
View File
@@ -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 =
+12
View File
@@ -0,0 +1,12 @@
```
% pandoc -f html -t latex
<table><tbody><tr></tr></tbody></table>
^D
\begin{longtable}[]{@{}l@{}}
\toprule\noalign{}
\endhead
\bottomrule\noalign{}
\endlastfoot
\\
\end{longtable}
```