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.
This commit is contained in:
parent
db5f6dd4fe
commit
bc508534a6
2 changed files with 18 additions and 1 deletions
|
@ -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
|
||||
|
|
14
test/command/5655.md
Normal file
14
test/command/5655.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
````
|
||||
% pandoc --webtex
|
||||
$T_n={n+1 \choose 2}$
|
||||
^D
|
||||
<p><img style="vertical-align:middle" src="https://latex.codecogs.com/png.latex?%5Ctextstyle%20T_n%3D%7Bn%2B1%20%5Cchoose%202%7D" alt="T_n={n+1 \choose 2}" title="T_n={n+1 \choose 2}" /></p>
|
||||
````
|
||||
|
||||
````
|
||||
% pandoc --webtex
|
||||
$$T_n={n+1 \choose 2}$$
|
||||
^D
|
||||
<p><br /><img style="vertical-align:middle" src="https://latex.codecogs.com/png.latex?T_n%3D%7Bn%2B1%20%5Cchoose%202%7D" alt="T_n={n+1 \choose 2}" title="T_n={n+1 \choose 2}" /><br /></p>
|
||||
````
|
||||
|
Loading…
Reference in a new issue