My goal is to publish a formula on a public webpage.
here is a formula:
z = FourierSeries[SquareWave[xyz], xyz, 3, FourierParameters -> {1, 2 Pi}]
launch a webpage using MathML:
CloudExport[z, "HTML", "MathOutput" -> "MathML", Permissions -> "Public"]
Works in Firefox but not in chrome. Chrome does not support MathML so I need another solution. MathJax is a plugin you can use in chrome to render a formula.
here is the reference to be used for the mathjax javascript:
mathjaxscript = "<script type=\"text/javascript\" src=\"https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=\
TeX-AMS-MML_HTMLorMML\"> </script>";
lets create a page and plug it in:
fullpage =
ExportString[z, "HTMLFragment", "URIHandler" -> "DataURI", "MathOutput" -> "MathML", "FullDocument" -> True];
st = ExportString["mypage", "HTMLFragment", "FullDocument" -> True]
finalpage = StringInsert[fullpage, mathjaxscript, StringPosition[st, "</head>"][[1, 1]]];
CloudExport[finalpage, "HTML", "MathOutput" -> "MathML", Permissions -> "Public"]
Okay the result in chrome is not good, just a little better but managing incompatibilities is unreliable and no fun. So the questions is if there is a reliable way to show a formula.
This generates a scalable picture text-description (SVG) and works in every browser in a size requested:
zz = "<center>" <> ExportString[ z , "SVG", ImageSize -> {1200, 300}] <> "</center>"
CloudExport[zz, "HTML", Permissions -> "Public"]
is this the way to go to publish formulas on public webpages? Is MathML not relevant anymore because of Chrome? Any views on the matter?