git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #2913 from jlduran/strut-minipage-tables
609fb33John MacFarlane
src/Text/Pandoc/Writers/LaTeX.hs+2−2
@@ -675,7 +675,8 @@ tableCellToLaTeX header (width, align, blocks) = do
675 AlignDefault -> "\\raggedright"
675 AlignDefault -> "\\raggedright"
676 return $ ("\\begin{minipage}" <> valign <>
676 return $ ("\\begin{minipage}" <> valign <>
677 braces (text (printf "%.2f\\columnwidth" width)) <>
677 braces (text (printf "%.2f\\columnwidth" width)) <>
678− (halign <> cr <> cellContents <> cr) <> "\\end{minipage}") $$
678+ (halign <> "\\strut" <> cr <> cellContents <> "\\strut" <> cr) <>
679+ "\\end{minipage}") $$
679 notesToLaTeX notes
680 notesToLaTeX notes
680
681
681notesToLaTeX :: [Doc] -> Doc
682notesToLaTeX :: [Doc] -> Doc
@@ -1306,4 +1307,3 @@ pDocumentClass =
1306 else do P.skipMany (P.satisfy (/='{'))
1307 else do P.skipMany (P.satisfy (/='{'))
1307 P.char '{'
1308 P.char '{'
1308 P.manyTill P.letter (P.char '}')
1309 P.manyTill P.letter (P.char '}')
1309−
tests/tables.latex+72−72
@@ -52,46 +52,46 @@ Multiline table with caption:
52\begin{longtable}[]{@{}clrl@{}}
52\begin{longtable}[]{@{}clrl@{}}
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]{0.13\columnwidth}\centering
55+\begin{minipage}[b]{0.13\columnwidth}\centering\strut
56−Centered Header
56+Centered Header\strut
57−\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright
57+\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright\strut
58−Left Aligned
58+Left Aligned\strut
59−\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft
59+\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft\strut
60−Right Aligned
60+Right Aligned\strut
61−\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright
61+\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright\strut
62−Default aligned
62+Default aligned\strut
63\end{minipage}\tabularnewline
63\end{minipage}\tabularnewline
64\midrule
64\midrule
65\endfirsthead
65\endfirsthead
66\toprule
66\toprule
67−\begin{minipage}[b]{0.13\columnwidth}\centering
67+\begin{minipage}[b]{0.13\columnwidth}\centering\strut
68−Centered Header
68+Centered Header\strut
69−\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright
69+\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright\strut
70−Left Aligned
70+Left Aligned\strut
71−\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft
71+\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft\strut
72−Right Aligned
72+Right Aligned\strut
73−\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright
73+\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright\strut
74−Default aligned
74+Default aligned\strut
75\end{minipage}\tabularnewline
75\end{minipage}\tabularnewline
76\midrule
76\midrule
77\endhead
77\endhead
78−\begin{minipage}[t]{0.13\columnwidth}\centering
78+\begin{minipage}[t]{0.13\columnwidth}\centering\strut
79−First
79+First\strut
80−\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright
80+\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
81−row
81+row\strut
82−\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft
82+\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft\strut
83−12.0
83+12.0\strut
84−\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
84+\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright\strut
85−Example of a row that spans multiple lines.
85+Example of a row that spans multiple lines.\strut
86\end{minipage}\tabularnewline
86\end{minipage}\tabularnewline
87−\begin{minipage}[t]{0.13\columnwidth}\centering
87+\begin{minipage}[t]{0.13\columnwidth}\centering\strut
88−Second
88+Second\strut
89−\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright
89+\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
90−row
90+row\strut
91−\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft
91+\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft\strut
92−5.0
92+5.0\strut
93−\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
93+\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright\strut
94−Here's another one. Note the blank line between rows.
94+Here's another one. Note the blank line between rows.\strut
95\end{minipage}\tabularnewline
95\end{minipage}\tabularnewline
96\bottomrule
96\bottomrule
97\end{longtable}
97\end{longtable}
@@ -100,34 +100,34 @@ Multiline table without caption:
100
100
101\begin{longtable}[]{@{}clrl@{}}
101\begin{longtable}[]{@{}clrl@{}}
102\toprule
102\toprule
103−\begin{minipage}[b]{0.13\columnwidth}\centering
103+\begin{minipage}[b]{0.13\columnwidth}\centering\strut
104−Centered Header
104+Centered Header\strut
105−\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright
105+\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright\strut
106−Left Aligned
106+Left Aligned\strut
107−\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft
107+\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft\strut
108−Right Aligned
108+Right Aligned\strut
109−\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright
109+\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright\strut
110−Default aligned
110+Default aligned\strut
111\end{minipage}\tabularnewline
111\end{minipage}\tabularnewline
112\midrule
112\midrule
113\endhead
113\endhead
114−\begin{minipage}[t]{0.13\columnwidth}\centering
114+\begin{minipage}[t]{0.13\columnwidth}\centering\strut
115−First
115+First\strut
116−\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright
116+\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
117−row
117+row\strut
118−\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft
118+\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft\strut
119−12.0
119+12.0\strut
120−\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
120+\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright\strut
121−Example of a row that spans multiple lines.
121+Example of a row that spans multiple lines.\strut
122\end{minipage}\tabularnewline
122\end{minipage}\tabularnewline
123−\begin{minipage}[t]{0.13\columnwidth}\centering
123+\begin{minipage}[t]{0.13\columnwidth}\centering\strut
124−Second
124+Second\strut
125−\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright
125+\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
126−row
126+row\strut
127−\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft
127+\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft\strut
128−5.0
128+5.0\strut
129−\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
129+\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright\strut
130−Here's another one. Note the blank line between rows.
130+Here's another one. Note the blank line between rows.\strut
131\end{minipage}\tabularnewline
131\end{minipage}\tabularnewline
132\bottomrule
132\bottomrule
133\end{longtable}
133\end{longtable}
@@ -146,23 +146,23 @@ Multiline table without column headers:
146
146
147\begin{longtable}[]{@{}clrl@{}}
147\begin{longtable}[]{@{}clrl@{}}
148\toprule
148\toprule
149−\begin{minipage}[t]{0.13\columnwidth}\centering
149+\begin{minipage}[t]{0.13\columnwidth}\centering\strut
150−First
150+First\strut
151−\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright
151+\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
152−row
152+row\strut
153−\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft
153+\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft\strut
154−12.0
154+12.0\strut
155−\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
155+\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright\strut
156−Example of a row that spans multiple lines.
156+Example of a row that spans multiple lines.\strut
157\end{minipage}\tabularnewline
157\end{minipage}\tabularnewline
158−\begin{minipage}[t]{0.13\columnwidth}\centering
158+\begin{minipage}[t]{0.13\columnwidth}\centering\strut
159−Second
159+Second\strut
160−\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright
160+\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright\strut
161−row
161+row\strut
162−\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft
162+\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft\strut
163−5.0
163+5.0\strut
164−\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
164+\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright\strut
165−Here's another one. Note the blank line between rows.
165+Here's another one. Note the blank line between rows.\strut
166\end{minipage}\tabularnewline
166\end{minipage}\tabularnewline
167\bottomrule
167\bottomrule
168\end{longtable}
168\end{longtable}