aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2023-10-17 21:22:53 -0700
committerJohn MacFarlane <[email protected]>2023-10-17 21:22:53 -0700
commit992bc86981e379e9b2a2913daa4ebdf9d8bec249 (patch)
treeb4f890a7fc4034f2fd6b7f833ecf6ad9f9f3bcd7
parentf4baa88f4267e2056269efa71ce78ee290b0e9aa (diff)
LaTeX writer: fix rowspans in tables...
...so they use the width of the column (`=` as the width parameter). Closes #9140.
-rw-r--r--src/Text/Pandoc/Writers/LaTeX/Table.hs3
-rw-r--r--test/tables/planets.latex6
2 files changed, 5 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX/Table.hs b/src/Text/Pandoc/Writers/LaTeX/Table.hs
index ee5c62a3b..702b22328 100644
--- a/src/Text/Pandoc/Writers/LaTeX/Table.hs
+++ b/src/Text/Pandoc/Writers/LaTeX/Table.hs
@@ -358,7 +358,8 @@ cellToLaTeX blockListToLaTeX isSimpleTable colCount celltype annotatedCell = do
(RowSpan 1) -> x
(RowSpan n) -> let nrows = literal (tshow n)
in "\\multirow" <> braces nrows
- <> braces "*" <> braces x
+ <> braces "=" -- width of column
+ <> braces x
return . inMultiColumn . inMultiRow $ result
-- | Returns the width of a cell spanning @n@ columns.
diff --git a/test/tables/planets.latex b/test/tables/planets.latex
index 8b013e3a8..b9d199c8d 100644
--- a/test/tables/planets.latex
+++ b/test/tables/planets.latex
@@ -17,16 +17,16 @@ temperature (C) & Number of moons & Notes \\
\bottomrule\noalign{}
\endlastfoot
\multicolumn{2}{@{}c}{%
-\multirow{4}{*}{Terrestrial planets}} & Mercury & 0.330 & 4,879 & 5427 & 3.7 &
+\multirow{4}{=}{Terrestrial planets}} & Mercury & 0.330 & 4,879 & 5427 & 3.7 &
4222.6 & 57.9 & 167 & 0 & Closest to the Sun \\
& & Venus & 4.87 & 12,104 & 5243 & 8.9 & 2802.0 & 108.2 & 464 & 0 & \\
& & Earth & 5.97 & 12,756 & 5514 & 9.8 & 24.0 & 149.6 & 15 & 1 & Our world \\
& & Mars & 0.642 & 6,792 & 3933 & 3.7 & 24.7 & 227.9 & -65 & 2 & The red
planet \\
-\multirow{4}{*}{Jovian planets} & \multirow{2}{*}{Gas giants} & Jupiter & 1898 &
+\multirow{4}{=}{Jovian planets} & \multirow{2}{=}{Gas giants} & Jupiter & 1898 &
142,984 & 1326 & 23.1 & 9.9 & 778.6 & -110 & 67 & The largest planet \\
& & Saturn & 568 & 120,536 & 687 & 9.0 & 10.7 & 1433.5 & -140 & 62 & \\
-& \multirow{2}{*}{Ice giants} & Uranus & 86.8 & 51,118 & 1271 & 8.7 & 17.2 &
+& \multirow{2}{=}{Ice giants} & Uranus & 86.8 & 51,118 & 1271 & 8.7 & 17.2 &
2872.5 & -195 & 27 & \\
& & Neptune & 102 & 49,528 & 1638 & 11.0 & 16.1 & 4495.1 & -200 & 14 & \\
\multicolumn{2}{@{}c}{%