aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2022-08-07 21:46:54 +0200
committerAlbert Krewinkel <[email protected]>2022-08-07 22:10:15 +0200
commit18484cbf47feb2ffa2d08db0f30107dcfdcf31f8 (patch)
treec52371cbbb9c03d716fcabaad833a67dc0a30bb3 /src
parentbf5edd9f02510a710bd888bb44e146f3c59995a5 (diff)
LaTeX writer: fix widths of multicolumn cells
Fixes: #8218
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX/Table.hs13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX/Table.hs b/src/Text/Pandoc/Writers/LaTeX/Table.hs
index 7298acd5c..38ba60764 100644
--- a/src/Text/Pandoc/Writers/LaTeX/Table.hs
+++ b/src/Text/Pandoc/Writers/LaTeX/Table.hs
@@ -330,20 +330,15 @@ multicolumnDescriptor align
width = sum $ NonEmpty.map toWidth colWidths
-- no column separators at beginning of first and end of last column.
- numseps = (case colnum + 1 of
- 1 -> 0 -- Not sure why this case is needed (tarleb)
- _ -> -- the final cell has only one tabcolsep
- if colnum + colspan == numcols
- then 1
- else 2) :: Int
skipColSep = "@{}" :: String
in T.pack $
- printf "%s>{%s\\arraybackslash}p{%0.4f\\columnwidth - %d\\tabcolsep}%s"
+ printf "%s>{%s\\arraybackslash}p{(\\columnwidth - %d\\tabcolsep) * \\real{%0.4f} + %d\\tabcolsep}%s"
(if colnum == 0 then skipColSep else "")
(T.unpack (alignCommand align))
+ (2 * (numcols - 1))
width
- numseps
- (if colnum + colspan == numcols then skipColSep else "")
+ (2 * (colspan - 1))
+ (if colnum + colspan >= numcols then skipColSep else "")
-- | Perform a conversion, assuming that the context is a minipage.
inMinipage :: Monad m => LW m a -> LW m a