git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: always use a minipage for cells with line breaks...
ed3974aJohn MacFarlane
src/Text/Pandoc/Writers/LaTeX/Table.hs+7−2
@@ -26,7 +26,8 @@ import Text.DocLayout
26 ( Doc, braces, cr, empty, hcat, hsep, isEmpty, literal, nest
26 ( Doc, braces, cr, empty, hcat, hsep, isEmpty, literal, nest
27 , text, vcat, ($$) )
27 , text, vcat, ($$) )
28import Text.Pandoc.Shared (blocksToInlines, splitBy, tshow)
28import Text.Pandoc.Shared (blocksToInlines, splitBy, tshow)
29−import Text.Pandoc.Walk (walk)
29+import Text.Pandoc.Walk (walk, query)
30+import Data.Monoid (Any(..))
30import Text.Pandoc.Writers.LaTeX.Caption (getCaption)
31import Text.Pandoc.Writers.LaTeX.Caption (getCaption)
31import Text.Pandoc.Writers.LaTeX.Notes (notesToLaTeX)
32import Text.Pandoc.Writers.LaTeX.Notes (notesToLaTeX)
32import Text.Pandoc.Writers.LaTeX.Types
33import Text.Pandoc.Writers.LaTeX.Types
@@ -261,8 +262,12 @@ cellToLaTeX blockListToLaTeX celltype annotatedCell = do
261 Para{} -> True
262 Para{} -> True
262 Plain{} -> True
263 Plain{} -> True
263 _ -> False
264 _ -> False
265+ let hasLineBreak LineBreak = Any True
266+ hasLineBreak _ = Any False
264 result <-
267 result <-
265− if not hasWidths || (celltype /= HeaderCell && all isPlainOrPara blocks)
268+ if not hasWidths || (celltype /= HeaderCell
269+ && all isPlainOrPara blocks
270+ && not (getAny (query hasLineBreak blocks)))
266 then
271 then
267 blockListToLaTeX $ walk fixLineBreaks $ walk displayMathToInline blocks
272 blockListToLaTeX $ walk fixLineBreaks $ walk displayMathToInline blocks
268 else do
273 else do
test/command/7272.md+4−1
@@ -18,7 +18,10 @@
18 >{\raggedright\arraybackslash}p{(\columnwidth - 0\tabcolsep) * \real{1.00}}@{}}
18 >{\raggedright\arraybackslash}p{(\columnwidth - 0\tabcolsep) * \real{1.00}}@{}}
19\toprule
19\toprule
20\endhead
20\endhead
21−{\vtop{\hbox{\strut text}\hbox{\strut text2 }}} \\
21+\begin{minipage}[t]{\linewidth}\raggedright
22+{ text\\
23+text2 }
24+\end{minipage} \\
22\bottomrule
25\bottomrule
23\end{longtable}
26\end{longtable}
24```
27```