On Jun 17, 2011, at 5:09 AM, Richard Heck wrote: > On 06/17/2011 03:07 AM, John Perry wrote: >> Hi >> >> I learned today that LyxHTML exports files that *almost* make MathJax happy. >> There are a few issues: newcommand's (i.e. math macros) don't seem to get >> exported by LyxHTML, and a header for MathJax would have to be inserted. >> >> Question: If I wanted to implement this in Lyx, would it have to be done in >> the source code proper? or is there a way to attach converters without >> modifying & recompiling the source? >> > If you could tell me precisely what needs to be done, it should be > fairly easy to add to the source.
(1) Math macros and other \newcommand's need to be output as \newcommand, not
ignored or put out as \global\long\def. Likewise \renewcommand needs to be
output as such. Some symbols, such as <, need to be converted to their html
counterparts so that the browser doesn't get confused.
(2) The following information needs to be added to the header:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js","jsMath2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
TeX: {
}
});
</script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
> If I remember correctly, MathJax expects LaTeX, yes?
Exactly.
> If so, then it
> would be pretty easy to export the math macros, I think, when we are in
> "export math as LaTeX" mode. I'd need to know exactly what they should
> look like.
I've described that above. I'm also attaching a sample html file. Notice the
\newcommand's; IMHO any such that appear in the LaTeX preamble should be added
to the body of the HTML file; Lyx does not do that currently. It's easy to add
those manually, of course, but it's darned annoying.
> As far as the MathJax header goes, this could certainly be added
> automatically, though we'd probably need a document setting for it,
> which would mean it couldn't go into 2.0.x. But in the meantime that
> line could easily be added manually, or you could write a simple
> "copier" to do it.
What is a "copier"? In all the attempts I've tried, I've done it by hand.
regards
john perry
test.xhtml
Description: test.xhtml
