@@ -16,6 +16,7 @@ module Text.Pandoc.Writers.LaTeX.Table
1616 ) where
1717import Control.Monad.State.Strict
1818import Data.List (intersperse)
19+import qualified Data.List.NonEmpty as NonEmpty
1920import Data.List.NonEmpty (NonEmpty ((:|)))
2021import Data.Text (Text)
2122import qualified Data.Text as T
@@ -243,8 +244,13 @@ cellToLaTeX :: PandocMonad m
243244 -> Ann.Cell
244245 -> LW m (Doc Text)
245246cellToLaTeX blockListToLaTeX celltype annotatedCell = do
246− let (Ann.Cell _specs _colnum cell) = annotatedCell
247− let (Cell _attr align rowspan colspan blocks) = cell
247+ let (Ann.Cell specs _colnum cell) = annotatedCell
248+ let hasWidths = snd (NonEmpty.head specs) /= ColWidthDefault
249+ let specAlign = fst (NonEmpty.head specs)
250+ let (Cell _attr align' rowspan colspan blocks) = cell
251+ let align = case align' of
252+ AlignDefault -> specAlign
253+ _ -> align'
248254 beamer <- gets stBeamer
249255 externalNotes <- gets stExternalNotes
250256 inMinipage <- gets stInMinipage
@@ -256,7 +262,7 @@ cellToLaTeX blockListToLaTeX celltype annotatedCell = do
256262 Plain{} -> True
257263 _ -> False
258264 result <-
259− if all isPlainOrPara blocks
265+ if not hasWidths || (celltype /= HeaderCell && all isPlainOrPara blocks)
260266 then
261267 blockListToLaTeX $ walk fixLineBreaks $ walk displayMathToInline blocks
262268 else do
@@ -290,3 +296,4 @@ cellToLaTeX blockListToLaTeX celltype annotatedCell = do
290296data CellType
291297 = HeaderCell
292298 | BodyCell
299+ deriving Eq