Self-resolved.:
When I analyze the state of the dom, I can see that it is due to the addition of span for expression display. In Elm, I added a class name (“inline”) to the target element, and based on that, I managed to fix it by removing the unnecessary one.
Elm:
htmlGenerator isDisplayMode stringLatex =
case isDisplayMode of
Just True →
div [style “font-size” “30px”] [ text stringLatex ]
Just False →
span [style “font-size” “30px”,class “inline”] [ text stringLatex ]
Nothing →
span [style “font-size” “30px”,class “human”] [ text stringLatex ]