aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-04-09 22:38:43 -0700
committerJohn MacFarlane <[email protected]>2025-04-09 22:38:43 -0700
commitc2482b910715f0dfa3210bd77a3479dede1df4e4 (patch)
treee79f78e9541c196da48459fb2ba1c0bdf19d72d0 /src
parentc589a89d8f16b12f2b407f63362f4006ef5fde86 (diff)
LaTeX writer: make alignment work within multirow in tables.
Closes #10772.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX/Table.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX/Table.hs b/src/Text/Pandoc/Writers/LaTeX/Table.hs
index 34d655d62..5eea02116 100644
--- a/src/Text/Pandoc/Writers/LaTeX/Table.hs
+++ b/src/Text/Pandoc/Writers/LaTeX/Table.hs
@@ -367,6 +367,10 @@ cellToLaTeX blockListToLaTeX isSimpleTable colCount celltype annotatedCell = do
<> braces ("%\n" <> x)
-- linebreak for readability
let hasColWidths = not (all (== ColWidthDefault) colWidths)
+ let aligncmd = case specAlign of
+ AlignCenter -> "\\centering\\arraybackslash "
+ AlignRight -> "\\raggedright\\arraybackslash "
+ _ -> mempty
let inMultiRow x = case rowspan of
(RowSpan 1) -> x
(RowSpan n) -> let nrows = literal (tshow n)
@@ -375,7 +379,7 @@ cellToLaTeX blockListToLaTeX isSimpleTable colCount celltype annotatedCell = do
(if hasColWidths
then "=" -- max width
else "*") -- natural width
- <> braces x
+ <> braces (aligncmd <> x)
return . inMultiColumn . inMultiRow $ result
-- | Returns the width of a cell spanning @n@ columns.