From 6c758434221dd4b717f26290dbb58e5377389f89 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 20 Jan 2012 14:05:14 -0800 Subject: Docx: Put display math on separate line. --- src/Text/Pandoc/Writers/Docx.hs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/Text/Pandoc/Writers/Docx.hs') diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index f0cb5b477..fb05c18a3 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -537,13 +537,17 @@ inlineToOpenXML opts (Quoted quoteType lst) = where (open, close) = case quoteType of SingleQuote -> ("\x2018", "\x2019") DoubleQuote -> ("\x201C", "\x201D") -inlineToOpenXML opts (Math t str) = - case texMathToOMML dt str of +inlineToOpenXML opts (Math InlineMath str) = + case texMathToOMML DisplayInline str of Right r -> return [r] Left _ -> inlinesToOpenXML opts (readTeXMath str) - where dt = if t == InlineMath - then DisplayInline - else DisplayBlock +inlineToOpenXML opts (Math DisplayMath str) = + case texMathToOMML DisplayBlock str of + Right r -> return [br, r, br] + Left _ -> do + fallback <- inlinesToOpenXML opts (readTeXMath str) + return $ [br] ++ fallback ++ [br] + where br = mknode "w:br" [] () inlineToOpenXML opts (Cite _ lst) = inlinesToOpenXML opts lst inlineToOpenXML _ (Code attrs str) = withTextProp (rStyle "VerbatimChar") -- cgit v1.2.3