From bc508534a648b900c683e60b1cc9681ed606a723 Mon Sep 17 00:00:00 2001 From: Philip Pesca Date: Tue, 23 Jul 2019 12:21:32 -0700 Subject: HTML writer: render inline formulas correctly with --webtex (#5656) We add `\textstyle` to the beginning of the formula to ensure it will be rendered in inline style. Closes #5655. --- src/Text/Pandoc/Writers/HTML.hs | 5 ++++- test/command/5655.md | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 test/command/5655.md diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index a0f6f17f0..84fd404b1 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -1062,8 +1062,11 @@ inlineToHtml opts inline = do case writerHTMLMathMethod opts of WebTeX url -> do let imtag = if html5 then H5.img else H.img + let s = case t of + InlineMath -> "\\textstyle " + DisplayMath -> "" let m = imtag ! A.style "vertical-align:middle" - ! A.src (toValue $ url ++ urlEncode str) + ! A.src (toValue $ url ++ urlEncode (s ++ str)) ! A.alt (toValue str) ! A.title (toValue str) let brtag = if html5 then H5.br else H.br diff --git a/test/command/5655.md b/test/command/5655.md new file mode 100644 index 000000000..de5a923ae --- /dev/null +++ b/test/command/5655.md @@ -0,0 +1,14 @@ +```` +% pandoc --webtex +$T_n={n+1 \choose 2}$ +^D +

T_n={n+1 \choose 2}

+```` + +```` +% pandoc --webtex +$$T_n={n+1 \choose 2}$$ +^D +


T_n={n+1 \choose 2}

+```` + -- cgit v1.2.3