git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: revert table line height increase in 2.11.3.

In 2.11.3 we started adding `\addlinespace`, which produced less dense tables. This wasn't an intentional change; I misunderstood a comment in the discussion leading up to the change. This commit restores the earlier default table appearance. Note that if you want a less dense table, you can use something like `\def\arraystretch{1.5}` in your header. Closes #6996.

commit9a18cf4b591364e7f0dc9b976628e91f8b31a6cf authorJohn MacFarlane <jgm@berkeley.edu> dateSat 2 Jan 2021, 07:56 (6 years ago) parent17e3efc
7 files changed+63−80
src/Text/Pandoc/Writers/LaTeX/Table.hs+1−1 test/command/2378.md+3−3 test/command/5367.md+3−3 test/tables.latex+26−35 test/tables/nordics.latex+8−10 test/tables/planets.latex+11−17 test/tables/students.latex+11−11
src/Text/Pandoc/Writers/LaTeX/Table.hs+1−1
@@ -169,7 +169,7 @@ rowToLaTeX :: PandocMonad m
169169 -> LW m (Doc Text)
170170rowToLaTeX blocksWriter celltype row = do
171171 cellsDocs <- mapM (cellToLaTeX blocksWriter celltype) (fillRow row)
172− return $ hsep (intersperse "&" cellsDocs) <> " \\\\ \\addlinespace"
172+ return $ hsep (intersperse "&" cellsDocs) <> " \\\\"
173173
174174-- | Pads row with empty cells to adjust for rowspans above this row.
175175fillRow :: [Ann.Cell] -> [Ann.Cell]
test/command/2378.md+3−3
@@ -14,14 +14,14 @@ is used.
1414\begin{longtable}[]{@{}ll@{}}
1515\caption{a table}\tabularnewline
1616\toprule
17−x & y\footnote{a footnote} \\ \addlinespace
17+x & y\footnote{a footnote} \\
1818\midrule
1919\endfirsthead
2020\toprule
21−x & y{} \\ \addlinespace
21+x & y{} \\
2222\midrule
2323\endhead
24−1 & 2 \\ \addlinespace
24+1 & 2 \\
2525\bottomrule
2626\end{longtable}
2727```
test/command/5367.md+3−3
@@ -24,14 +24,14 @@ hello\footnote{doc footnote}
2424 >{\centering\arraybackslash}p{(\columnwidth - 0\tabcolsep) * \real{0.17}}@{}}
2525\caption[Sample table.]{Sample table.\footnote{caption footnote}}\tabularnewline
2626\toprule
27−Fruit\footnote{header footnote} \\ \addlinespace
27+Fruit\footnote{header footnote} \\
2828\midrule
2929\endfirsthead
3030\toprule
31−Fruit{} \\ \addlinespace
31+Fruit{} \\
3232\midrule
3333\endhead
34−Bans\footnote{table cell footnote} \\ \addlinespace
34+Bans\footnote{table cell footnote} \\
3535\bottomrule
3636\end{longtable}
3737
test/tables.latex+26−35
@@ -3,16 +3,16 @@ Simple table with caption:
33\begin{longtable}[]{@{}rlcl@{}}
44\caption{Demonstration of simple table syntax.}\tabularnewline
55\toprule
6−Right & Left & Center & Default \\ \addlinespace
6+Right & Left & Center & Default \\
77\midrule
88\endfirsthead
99\toprule
10−Right & Left & Center & Default \\ \addlinespace
10+Right & Left & Center & Default \\
1111\midrule
1212\endhead
13−12 & 12 & 12 & 12 \\ \addlinespace
14−123 & 123 & 123 & 123 \\ \addlinespace
15−1 & 1 & 1 & 1 \\ \addlinespace
13+12 & 12 & 12 & 12 \\
14+123 & 123 & 123 & 123 \\
15+1 & 1 & 1 & 1 \\
1616\bottomrule
1717\end{longtable}
1818
@@ -20,12 +20,12 @@ Simple table without caption:
2020
2121\begin{longtable}[]{@{}rlcl@{}}
2222\toprule
23−Right & Left & Center & Default \\ \addlinespace
23+Right & Left & Center & Default \\
2424\midrule
2525\endhead
26−12 & 12 & 12 & 12 \\ \addlinespace
27−123 & 123 & 123 & 123 \\ \addlinespace
28−1 & 1 & 1 & 1 \\ \addlinespace
26+12 & 12 & 12 & 12 \\
27+123 & 123 & 123 & 123 \\
28+1 & 1 & 1 & 1 \\
2929\bottomrule
3030\end{longtable}
3131
@@ -34,16 +34,16 @@ Simple table indented two spaces:
3434\begin{longtable}[]{@{}rlcl@{}}
3535\caption{Demonstration of simple table syntax.}\tabularnewline
3636\toprule
37−Right & Left & Center & Default \\ \addlinespace
37+Right & Left & Center & Default \\
3838\midrule
3939\endfirsthead
4040\toprule
41−Right & Left & Center & Default \\ \addlinespace
41+Right & Left & Center & Default \\
4242\midrule
4343\endhead
44−12 & 12 & 12 & 12 \\ \addlinespace
45−123 & 123 & 123 & 123 \\ \addlinespace
46−1 & 1 & 1 & 1 \\ \addlinespace
44+12 & 12 & 12 & 12 \\
45+123 & 123 & 123 & 123 \\
46+1 & 1 & 1 & 1 \\
4747\bottomrule
4848\end{longtable}
4949
@@ -56,19 +56,15 @@ Multiline table with caption:
5656 >{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.35}}@{}}
5757\caption{Here's the caption. It may span multiple lines.}\tabularnewline
5858\toprule
59−Centered Header & Left Aligned & Right Aligned & Default
60−aligned \\ \addlinespace
59+Centered Header & Left Aligned & Right Aligned & Default aligned \\
6160\midrule
6261\endfirsthead
6362\toprule
64−Centered Header & Left Aligned & Right Aligned & Default
65−aligned \\ \addlinespace
63+Centered Header & Left Aligned & Right Aligned & Default aligned \\
6664\midrule
6765\endhead
68−First & row & 12.0 & Example of a row that spans multiple
69−lines. \\ \addlinespace
70−Second & row & 5.0 & Here's another one. Note the blank line between
71−rows. \\ \addlinespace
66+First & row & 12.0 & Example of a row that spans multiple lines. \\
67+Second & row & 5.0 & Here's another one. Note the blank line between rows. \\
7268\bottomrule
7369\end{longtable}
7470
@@ -80,14 +76,11 @@ Multiline table without caption:
8076 >{\raggedleft\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.16}}
8177 >{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.35}}@{}}
8278\toprule
83−Centered Header & Left Aligned & Right Aligned & Default
84−aligned \\ \addlinespace
79+Centered Header & Left Aligned & Right Aligned & Default aligned \\
8580\midrule
8681\endhead
87−First & row & 12.0 & Example of a row that spans multiple
88−lines. \\ \addlinespace
89−Second & row & 5.0 & Here's another one. Note the blank line between
90−rows. \\ \addlinespace
82+First & row & 12.0 & Example of a row that spans multiple lines. \\
83+Second & row & 5.0 & Here's another one. Note the blank line between rows. \\
9184\bottomrule
9285\end{longtable}
9386
@@ -96,9 +89,9 @@ Table without column headers:
9689\begin{longtable}[]{@{}rlcr@{}}
9790\toprule
9891\endhead
99−12 & 12 & 12 & 12 \\ \addlinespace
100−123 & 123 & 123 & 123 \\ \addlinespace
101−1 & 1 & 1 & 1 \\ \addlinespace
92+12 & 12 & 12 & 12 \\
93+123 & 123 & 123 & 123 \\
94+1 & 1 & 1 & 1 \\
10295\bottomrule
10396\end{longtable}
10497
@@ -111,9 +104,7 @@ Multiline table without column headers:
111104 >{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.35}}@{}}
112105\toprule
113106\endhead
114−First & row & 12.0 & Example of a row that spans multiple
115−lines. \\ \addlinespace
116−Second & row & 5.0 & Here's another one. Note the blank line between
117−rows. \\ \addlinespace
107+First & row & 12.0 & Example of a row that spans multiple lines. \\
108+Second & row & 5.0 & Here's another one. Note the blank line between rows. \\
118109\bottomrule
119110\end{longtable}
test/tables/nordics.latex+8−10
@@ -6,21 +6,19 @@
66\caption{States belonging to the \emph{Nordics.}}\tabularnewline
77\toprule
88Name & Capital & \vtop{\hbox{\strut Population}\hbox{\strut (in 2018)}} &
9−\vtop{\hbox{\strut Area}\hbox{\strut (in
10−km\textsuperscript{2})}} \\ \addlinespace
9+\vtop{\hbox{\strut Area}\hbox{\strut (in km\textsuperscript{2})}} \\
1110\midrule
1211\endfirsthead
1312\toprule
1413Name & Capital & \vtop{\hbox{\strut Population}\hbox{\strut (in 2018)}} &
15−\vtop{\hbox{\strut Area}\hbox{\strut (in
16−km\textsuperscript{2})}} \\ \addlinespace
14+\vtop{\hbox{\strut Area}\hbox{\strut (in km\textsuperscript{2})}} \\
1715\midrule
1816\endhead
19−Denmark & Copenhagen & 5,809,502 & 43,094 \\ \addlinespace
20−Finland & Helsinki & 5,537,364 & 338,145 \\ \addlinespace
21−Iceland & Reykjavik & 343,518 & 103,000 \\ \addlinespace
22−Norway & Oslo & 5,372,191 & 323,802 \\ \addlinespace
23−Sweden & Stockholm & 10,313,447 & 450,295 \\ \addlinespace
24−Total & & 27,376,022 & 1,258,336 \\ \addlinespace
17+Denmark & Copenhagen & 5,809,502 & 43,094 \\
18+Finland & Helsinki & 5,537,364 & 338,145 \\
19+Iceland & Reykjavik & 343,518 & 103,000 \\
20+Norway & Oslo & 5,372,191 & 323,802 \\
21+Sweden & Stockholm & 10,313,447 & 450,295 \\
22+Total & & 27,376,022 & 1,258,336 \\
2523\bottomrule
2624\end{longtable}
test/tables/planets.latex+11−17
@@ -3,34 +3,28 @@
33\toprule
44\multicolumn{2}{l}{} & Name & Mass (10\^{}24kg) & Diameter (km) & Density
55(kg/m\^{}3) & Gravity (m/s\^{}2) & Length of day (hours) & Distance from Sun
6−(10\^{}6km) & Mean temperature (C) & Number of moons & Notes \\ \addlinespace
6+(10\^{}6km) & Mean temperature (C) & Number of moons & Notes \\
77\midrule
88\endfirsthead
99\toprule
1010\multicolumn{2}{l}{} & Name & Mass (10\^{}24kg) & Diameter (km) & Density
1111(kg/m\^{}3) & Gravity (m/s\^{}2) & Length of day (hours) & Distance from Sun
12−(10\^{}6km) & Mean temperature (C) & Number of moons & Notes \\ \addlinespace
12+(10\^{}6km) & Mean temperature (C) & Number of moons & Notes \\
1313\midrule
1414\endhead
1515\multicolumn{2}{l}{\multirow{4}{*}{Terrestrial planets}} & Mercury & 0.330 &
16−4,879 & 5427 & 3.7 & 4222.6 & 57.9 & 167 & 0 & Closest to the
17−Sun \\ \addlinespace
18−& & Venus & 4.87 & 12,104 & 5243 & 8.9 & 2802.0 & 108.2 & 464 & 0
19−& \\ \addlinespace
20−& & Earth & 5.97 & 12,756 & 5514 & 9.8 & 24.0 & 149.6 & 15 & 1 & Our
21−world \\ \addlinespace
16+4,879 & 5427 & 3.7 & 4222.6 & 57.9 & 167 & 0 & Closest to the Sun \\
17+& & Venus & 4.87 & 12,104 & 5243 & 8.9 & 2802.0 & 108.2 & 464 & 0 & \\
18+& & Earth & 5.97 & 12,756 & 5514 & 9.8 & 24.0 & 149.6 & 15 & 1 & Our world \\
2219& & Mars & 0.642 & 6,792 & 3933 & 3.7 & 24.7 & 227.9 & -65 & 2 & The red
23−planet \\ \addlinespace
20+planet \\
2421\multirow{4}{*}{Jovian planets} & \multirow{2}{*}{Gas giants} & Jupiter & 1898
25−& 142,984 & 1326 & 23.1 & 9.9 & 778.6 & -110 & 67 & The largest
26−planet \\ \addlinespace
27−& & Saturn & 568 & 120,536 & 687 & 9.0 & 10.7 & 1433.5 & -140 & 62
28−& \\ \addlinespace
22+& 142,984 & 1326 & 23.1 & 9.9 & 778.6 & -110 & 67 & The largest planet \\
23+& & Saturn & 568 & 120,536 & 687 & 9.0 & 10.7 & 1433.5 & -140 & 62 & \\
2924& \multirow{2}{*}{Ice giants} & Uranus & 86.8 & 51,118 & 1271 & 8.7 & 17.2 &
30−2872.5 & -195 & 27 & \\ \addlinespace
31−& & Neptune & 102 & 49,528 & 1638 & 11.0 & 16.1 & 4495.1 & -200 & 14
32−& \\ \addlinespace
25+2872.5 & -195 & 27 & \\
26+& & Neptune & 102 & 49,528 & 1638 & 11.0 & 16.1 & 4495.1 & -200 & 14 & \\
3327\multicolumn{2}{l}{Dwarf planets} & Pluto & 0.0146 & 2,370 & 2095 & 0.7 &
34−153.3 & 5906.4 & -225 & 5 & Declassified as a planet in 2006. \\ \addlinespace
28+153.3 & 5906.4 & -225 & 5 & Declassified as a planet in 2006. \\
3529\bottomrule
3630\end{longtable}
test/tables/students.latex+11−11
@@ -3,21 +3,21 @@
33 >{\raggedright\arraybackslash}p{(\columnwidth - 2\tabcolsep) * \real{0.50}}@{}}
44\caption{List of Students}\tabularnewline
55\toprule
6−Student ID & Name \\ \addlinespace
6+Student ID & Name \\
77\midrule
88\endfirsthead
99\toprule
10−Student ID & Name \\ \addlinespace
10+Student ID & Name \\
1111\midrule
1212\endhead
13−\multicolumn{2}{l}{Computer Science} \\ \addlinespace
14−3741255 & Jones, Martha \\ \addlinespace
15−4077830 & Pierce, Benjamin \\ \addlinespace
16−5151701 & Kirk, James \\ \addlinespace
17−\multicolumn{2}{l}{Russian Literature} \\ \addlinespace
18−3971244 & Nim, Victor \\ \addlinespace
19−\multicolumn{2}{l}{Astrophysics} \\ \addlinespace
20−4100332 & Petrov, Alexandra \\ \addlinespace
21−4100332 & Toyota, Hiroko \\ \addlinespace
13+\multicolumn{2}{l}{Computer Science} \\
14+3741255 & Jones, Martha \\
15+4077830 & Pierce, Benjamin \\
16+5151701 & Kirk, James \\
17+\multicolumn{2}{l}{Russian Literature} \\
18+3971244 & Nim, Victor \\
19+\multicolumn{2}{l}{Astrophysics} \\
20+4100332 & Petrov, Alexandra \\
21+4100332 & Toyota, Hiroko \\
2222\bottomrule
2323\end{longtable}