aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-06-21 23:31:27 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2021-06-21 23:33:00 -0700
commit8eed5b90d09a4a0c2592c92215fa96c69cf35234 (patch)
treea208157c986b8a52f2b081d115d472b37c86c411 /src/Text
parent9867231779c32ddc2cce85d869de2ef586707244 (diff)
downloadpandoc-8eed5b90d09a4a0c2592c92215fa96c69cf35234.tar.gz
LaTeX writer: add strut at end of minipage if it contains...
line breaks. Without them, the last line is shorter than it should be, at least in some cases.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX/Table.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX/Table.hs b/src/Text/Pandoc/Writers/LaTeX/Table.hs
index abdc26649..27a8a0257 100644
--- a/src/Text/Pandoc/Writers/LaTeX/Table.hs
+++ b/src/Text/Pandoc/Writers/LaTeX/Table.hs
@@ -264,10 +264,11 @@ cellToLaTeX blockListToLaTeX celltype annotatedCell = do
_ -> False
let hasLineBreak LineBreak = Any True
hasLineBreak _ = Any False
+ let hasLineBreaks = getAny $ query hasLineBreak blocks
result <-
if not hasWidths || (celltype /= HeaderCell
&& all isPlainOrPara blocks
- && not (getAny (query hasLineBreak blocks)))
+ && not hasLineBreaks)
then
blockListToLaTeX $ walk fixLineBreaks $ walk displayMathToInline blocks
else do
@@ -280,7 +281,9 @@ cellToLaTeX blockListToLaTeX celltype annotatedCell = do
let halign = literal $ alignCommand align
return $ "\\begin{minipage}" <> valign <>
braces "\\linewidth" <> halign <> cr <>
- cellContents <> cr <>
+ cellContents <>
+ (if hasLineBreaks then "\\strut" else mempty)
+ <> cr <>
"\\end{minipage}"
modify $ \st -> st{ stExternalNotes = externalNotes }
when (rowspan /= RowSpan 1) $