@@ -459,9 +459,13 @@ inlineToHtml opts inline =
459459 modify (\st -> st {stMath = True}) >>
460460 (case writerHTMLMathMethod opts of
461461 LaTeXMathML _ ->
462− return $ if t == InlineMath
463− then primHtml ("$" ++ str ++ "$")
464− else primHtml ("$$" ++ str ++ "$$")
462+ -- putting LaTeXMathML in container with class "LaTeX" prevents
463+ -- non-math elements on the page from being treated as math by
464+ -- the javascript
465+ return $ thespan ! [theclass "LaTeX"] $
466+ if t == InlineMath
467+ then primHtml ("$" ++ str ++ "$")
468+ else primHtml ("$$" ++ str ++ "$$")
465469 MimeTeX url ->
466470 return $ image ! [src (url ++ "?" ++ str),
467471 alt str, title str]