diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-12-15 21:14:07 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-12-15 21:14:07 -0800 |
commit | 61d2c2e8cb3ba5e55ac059324abca0bf235bb36d (patch) | |
tree | 63e67129de745f36d4f3eb76b43cd5feabc7ef9e /src/Text | |
parent | cb8bb4705ff003ce15b4a99c1dfdfa168e2c2bbd (diff) | |
download | pandoc-61d2c2e8cb3ba5e55ac059324abca0bf235bb36d.tar.gz |
LaTeX writer: better handling of display math in simple tables.
We convert display math to inline math in simple tables,
since LaTeX can't deal with display math in simple tables.
Closes #1754.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 2c86d1a6e..7fe85a5a5 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -545,10 +545,16 @@ fixLineBreaks' ils = case splitBy (== LineBreak) ils of where tohbox ys = RawInline "tex" "\\hbox{\\strut " : ys ++ [RawInline "tex" "}"] +-- We also change display math to inline math, since display +-- math breaks in simple tables. +displayMathToInline :: Inline -> Inline +displayMathToInline (Math DisplayMath x) = Math InlineMath x +displayMathToInline x = x + tableCellToLaTeX :: Bool -> (Double, Alignment, [Block]) -> State WriterState Doc tableCellToLaTeX _ (0, _, blocks) = - blockListToLaTeX $ walk fixLineBreaks blocks + blockListToLaTeX $ walk fixLineBreaks $ walk displayMathToInline blocks tableCellToLaTeX header (width, align, blocks) = do modify $ \st -> st{ stInMinipage = True, stNotes = [] } cellContents <- blockListToLaTeX blocks |