aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-12-15 21:14:07 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-12-15 21:14:07 -0800
commit61d2c2e8cb3ba5e55ac059324abca0bf235bb36d (patch)
tree63e67129de745f36d4f3eb76b43cd5feabc7ef9e /src/Text
parentcb8bb4705ff003ce15b4a99c1dfdfa168e2c2bbd (diff)
downloadpandoc-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.hs8
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