git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: Improve table spacing.
b5b5ef9John MacFarlane
src/Text/Pandoc/Writers/LaTeX.hs+2−2
@@ -862,7 +862,7 @@ tableRowToLaTeX header aligns widths cols = do
862 else widths
862 else widths
863 let numcols = length widths'
863 let numcols = length widths'
864 cells <- mapM (tableCellToLaTeX header numcols) $ zip3 widths' aligns cols
864 cells <- mapM (tableCellToLaTeX header numcols) $ zip3 widths' aligns cols
865− return $ hsep (intersperse "&" cells) <> "\\tabularnewline"
865+ return $ hsep (intersperse "&" cells) <> " \\\\ \\addlinespace"
866
866
867-- For simple latex tables (without minipages or parboxes),
867-- For simple latex tables (without minipages or parboxes),
868-- we need to go to some lengths to get line breaks working:
868-- we need to go to some lengths to get line breaks working:
@@ -914,7 +914,7 @@ tableCellToLaTeX header numcols (width, align, blocks) = do
914 braces (text (printf
914 braces (text (printf
915 "(\\columnwidth - %d\\tabcolsep) * \\real{%.2f}"
915 "(\\columnwidth - %d\\tabcolsep) * \\real{%.2f}"
916 (numcols - 1) width)) <>
916 (numcols - 1) width)) <>
917− halign <> cr <> cellContents <> "\\strut" <> cr <>
917+ halign <> cr <> cellContents <> cr <>
918 "\\end{minipage}"
918 "\\end{minipage}"
919-- (\columnwidth - 8\tabcolsep) * \real{0.15}
919-- (\columnwidth - 8\tabcolsep) * \real{0.15}
920
920
test/command/2378.md+3−3
@@ -14,14 +14,14 @@ is used.
14\begin{longtable}[]{@{}ll@{}}
14\begin{longtable}[]{@{}ll@{}}
15\caption{a table}\tabularnewline
15\caption{a table}\tabularnewline
16\toprule
16\toprule
17−x & y\footnote{a footnote}\tabularnewline
17+x & y\footnote{a footnote} \\ \addlinespace
18\midrule
18\midrule
19\endfirsthead
19\endfirsthead
20\toprule
20\toprule
21−x & y{}\tabularnewline
21+x & y{} \\ \addlinespace
22\midrule
22\midrule
23\endhead
23\endhead
24−1 & 2\tabularnewline
24+1 & 2 \\ \addlinespace
25\bottomrule
25\bottomrule
26\end{longtable}
26\end{longtable}
27```
27```
test/command/5367.md+6−6
@@ -24,19 +24,19 @@ hello\footnote{doc footnote}
24\caption[Sample table.]{Sample table.\footnote{caption footnote}}\tabularnewline
24\caption[Sample table.]{Sample table.\footnote{caption footnote}}\tabularnewline
25\toprule
25\toprule
26\begin{minipage}[b]{(\columnwidth - 0\tabcolsep) * \real{0.17}}\centering
26\begin{minipage}[b]{(\columnwidth - 0\tabcolsep) * \real{0.17}}\centering
27−Fruit\footnote{header footnote}\strut
27+Fruit\footnote{header footnote}
28−\end{minipage}\tabularnewline
28+\end{minipage} \\ \addlinespace
29\midrule
29\midrule
30\endfirsthead
30\endfirsthead
31\toprule
31\toprule
32\begin{minipage}[b]{(\columnwidth - 0\tabcolsep) * \real{0.17}}\centering
32\begin{minipage}[b]{(\columnwidth - 0\tabcolsep) * \real{0.17}}\centering
33−Fruit{}\strut
33+Fruit{}
34−\end{minipage}\tabularnewline
34+\end{minipage} \\ \addlinespace
35\midrule
35\midrule
36\endhead
36\endhead
37\begin{minipage}[t]{(\columnwidth - 0\tabcolsep) * \real{0.17}}\centering
37\begin{minipage}[t]{(\columnwidth - 0\tabcolsep) * \real{0.17}}\centering
38−Bans\footnote{table cell footnote}\strut
38+Bans\footnote{table cell footnote}
39−\end{minipage}\tabularnewline
39+\end{minipage} \\ \addlinespace
40\bottomrule
40\bottomrule
41\end{longtable}
41\end{longtable}
42
42
test/tables.latex+62−62
@@ -3,16 +3,16 @@ Simple table with caption:
3\begin{longtable}[]{@{}rlcl@{}}
3\begin{longtable}[]{@{}rlcl@{}}
4\caption{Demonstration of simple table syntax.}\tabularnewline
4\caption{Demonstration of simple table syntax.}\tabularnewline
5\toprule
5\toprule
6−Right & Left & Center & Default\tabularnewline
6+Right & Left & Center & Default \\ \addlinespace
7\midrule
7\midrule
8\endfirsthead
8\endfirsthead
9\toprule
9\toprule
10−Right & Left & Center & Default\tabularnewline
10+Right & Left & Center & Default \\ \addlinespace
11\midrule
11\midrule
12\endhead
12\endhead
13−12 & 12 & 12 & 12\tabularnewline
13+12 & 12 & 12 & 12 \\ \addlinespace
14−123 & 123 & 123 & 123\tabularnewline
14+123 & 123 & 123 & 123 \\ \addlinespace
15−1 & 1 & 1 & 1\tabularnewline
15+1 & 1 & 1 & 1 \\ \addlinespace
16\bottomrule
16\bottomrule
17\end{longtable}
17\end{longtable}
18
18
@@ -20,12 +20,12 @@ Simple table without caption:
20
20
21\begin{longtable}[]{@{}rlcl@{}}
21\begin{longtable}[]{@{}rlcl@{}}
22\toprule
22\toprule
23−Right & Left & Center & Default\tabularnewline
23+Right & Left & Center & Default \\ \addlinespace
24\midrule
24\midrule
25\endhead
25\endhead
26−12 & 12 & 12 & 12\tabularnewline
26+12 & 12 & 12 & 12 \\ \addlinespace
27−123 & 123 & 123 & 123\tabularnewline
27+123 & 123 & 123 & 123 \\ \addlinespace
28−1 & 1 & 1 & 1\tabularnewline
28+1 & 1 & 1 & 1 \\ \addlinespace
29\bottomrule
29\bottomrule
30\end{longtable}
30\end{longtable}
31
31
@@ -34,16 +34,16 @@ Simple table indented two spaces:
34\begin{longtable}[]{@{}rlcl@{}}
34\begin{longtable}[]{@{}rlcl@{}}
35\caption{Demonstration of simple table syntax.}\tabularnewline
35\caption{Demonstration of simple table syntax.}\tabularnewline
36\toprule
36\toprule
37−Right & Left & Center & Default\tabularnewline
37+Right & Left & Center & Default \\ \addlinespace
38\midrule
38\midrule
39\endfirsthead
39\endfirsthead
40\toprule
40\toprule
41−Right & Left & Center & Default\tabularnewline
41+Right & Left & Center & Default \\ \addlinespace
42\midrule
42\midrule
43\endhead
43\endhead
44−12 & 12 & 12 & 12\tabularnewline
44+12 & 12 & 12 & 12 \\ \addlinespace
45−123 & 123 & 123 & 123\tabularnewline
45+123 & 123 & 123 & 123 \\ \addlinespace
46−1 & 1 & 1 & 1\tabularnewline
46+1 & 1 & 1 & 1 \\ \addlinespace
47\bottomrule
47\bottomrule
48\end{longtable}
48\end{longtable}
49
49
@@ -53,58 +53,58 @@ Multiline table with caption:
53\caption{Here's the caption. It may span multiple lines.}\tabularnewline
53\caption{Here's the caption. It may span multiple lines.}\tabularnewline
54\toprule
54\toprule
55\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
55\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
56−Centered Header\strut
56+Centered Header
57\end{minipage} &
57\end{minipage} &
58\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
58\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
59−Left Aligned\strut
59+Left Aligned
60\end{minipage} &
60\end{minipage} &
61\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
61\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
62−Right Aligned\strut
62+Right Aligned
63\end{minipage} &
63\end{minipage} &
64\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
64\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
65−Default aligned\strut
65+Default aligned
66−\end{minipage}\tabularnewline
66+\end{minipage} \\ \addlinespace
67\midrule
67\midrule
68\endfirsthead
68\endfirsthead
69\toprule
69\toprule
70\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
70\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
71−Centered Header\strut
71+Centered Header
72\end{minipage} &
72\end{minipage} &
73\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
73\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
74−Left Aligned\strut
74+Left Aligned
75\end{minipage} &
75\end{minipage} &
76\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
76\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
77−Right Aligned\strut
77+Right Aligned
78\end{minipage} &
78\end{minipage} &
79\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
79\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
80−Default aligned\strut
80+Default aligned
81−\end{minipage}\tabularnewline
81+\end{minipage} \\ \addlinespace
82\midrule
82\midrule
83\endhead
83\endhead
84\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
84\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
85−First\strut
85+First
86\end{minipage} &
86\end{minipage} &
87\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
87\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
88−row\strut
88+row
89\end{minipage} &
89\end{minipage} &
90\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
90\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
91−12.0\strut
91+12.0
92\end{minipage} &
92\end{minipage} &
93\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
93\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
94−Example of a row that spans multiple lines.\strut
94+Example of a row that spans multiple lines.
95−\end{minipage}\tabularnewline
95+\end{minipage} \\ \addlinespace
96\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
96\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
97−Second\strut
97+Second
98\end{minipage} &
98\end{minipage} &
99\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
99\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
100−row\strut
100+row
101\end{minipage} &
101\end{minipage} &
102\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
102\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
103−5.0\strut
103+5.0
104\end{minipage} &
104\end{minipage} &
105\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
105\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
106−Here's another one. Note the blank line between rows.\strut
106+Here's another one. Note the blank line between rows.
107−\end{minipage}\tabularnewline
107+\end{minipage} \\ \addlinespace
108\bottomrule
108\bottomrule
109\end{longtable}
109\end{longtable}
110
110
@@ -113,43 +113,43 @@ Multiline table without caption:
113\begin{longtable}[]{@{}clrl@{}}
113\begin{longtable}[]{@{}clrl@{}}
114\toprule
114\toprule
115\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
115\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
116−Centered Header\strut
116+Centered Header
117\end{minipage} &
117\end{minipage} &
118\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
118\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
119−Left Aligned\strut
119+Left Aligned
120\end{minipage} &
120\end{minipage} &
121\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
121\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
122−Right Aligned\strut
122+Right Aligned
123\end{minipage} &
123\end{minipage} &
124\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
124\begin{minipage}[b]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
125−Default aligned\strut
125+Default aligned
126−\end{minipage}\tabularnewline
126+\end{minipage} \\ \addlinespace
127\midrule
127\midrule
128\endhead
128\endhead
129\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
129\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
130−First\strut
130+First
131\end{minipage} &
131\end{minipage} &
132\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
132\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
133−row\strut
133+row
134\end{minipage} &
134\end{minipage} &
135\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
135\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
136−12.0\strut
136+12.0
137\end{minipage} &
137\end{minipage} &
138\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
138\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
139−Example of a row that spans multiple lines.\strut
139+Example of a row that spans multiple lines.
140−\end{minipage}\tabularnewline
140+\end{minipage} \\ \addlinespace
141\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
141\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
142−Second\strut
142+Second
143\end{minipage} &
143\end{minipage} &
144\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
144\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
145−row\strut
145+row
146\end{minipage} &
146\end{minipage} &
147\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
147\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
148−5.0\strut
148+5.0
149\end{minipage} &
149\end{minipage} &
150\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
150\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
151−Here's another one. Note the blank line between rows.\strut
151+Here's another one. Note the blank line between rows.
152−\end{minipage}\tabularnewline
152+\end{minipage} \\ \addlinespace
153\bottomrule
153\bottomrule
154\end{longtable}
154\end{longtable}
155
155
@@ -158,9 +158,9 @@ Table without column headers:
158\begin{longtable}[]{@{}rlcr@{}}
158\begin{longtable}[]{@{}rlcr@{}}
159\toprule
159\toprule
160\endhead
160\endhead
161−12 & 12 & 12 & 12\tabularnewline
161+12 & 12 & 12 & 12 \\ \addlinespace
162−123 & 123 & 123 & 123\tabularnewline
162+123 & 123 & 123 & 123 \\ \addlinespace
163−1 & 1 & 1 & 1\tabularnewline
163+1 & 1 & 1 & 1 \\ \addlinespace
164\bottomrule
164\bottomrule
165\end{longtable}
165\end{longtable}
166
166
@@ -170,28 +170,28 @@ Multiline table without column headers:
170\toprule
170\toprule
171\endhead
171\endhead
172\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
172\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
173−First\strut
173+First
174\end{minipage} &
174\end{minipage} &
175\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
175\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
176−row\strut
176+row
177\end{minipage} &
177\end{minipage} &
178\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
178\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
179−12.0\strut
179+12.0
180\end{minipage} &
180\end{minipage} &
181\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
181\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
182−Example of a row that spans multiple lines.\strut
182+Example of a row that spans multiple lines.
183−\end{minipage}\tabularnewline
183+\end{minipage} \\ \addlinespace
184\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
184\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.15}}\centering
185−Second\strut
185+Second
186\end{minipage} &
186\end{minipage} &
187\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
187\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.14}}\raggedright
188−row\strut
188+row
189\end{minipage} &
189\end{minipage} &
190\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
190\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.16}}\raggedleft
191−5.0\strut
191+5.0
192\end{minipage} &
192\end{minipage} &
193\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
193\begin{minipage}[t]{(\columnwidth - 3\tabcolsep) * \real{0.35}}\raggedright
194−Here's another one. Note the blank line between rows.\strut
194+Here's another one. Note the blank line between rows.
195−\end{minipage}\tabularnewline
195+\end{minipage} \\ \addlinespace
196\bottomrule
196\bottomrule
197\end{longtable}
197\end{longtable}