Hi,

   Not all browsers support MathML in a nice way. Another approach to embed 
mathematics in Html is to use the MathJax javascript library 
(http://www.mathjax.org/) that makes clever use of CSS for displaying Math. 
I've created a patch for including this functionality when exporting to 
html so the same code can be used for Html and latex backends.

Here it is the diff against asciidoc-8.6.8:

diff -r 07b55a89f0c6 xhtml11.conf
--- a/xhtml11.conf    Wed Oct 24 21:29:16 2012 +0200
+++ b/xhtml11.conf    Wed Oct 24 21:41:15 2012 +0200
@@ -616,6 +616,21 @@
 /*]]>*/
 </script>
 endif::linkcss[]
+ifdef::mathjax[]
+<script type="text/x-mathjax-config">
+    MathJax.Hub.Config({
+      extensions: ["tex2jax.js"],
+      jax: ["input/TeX", "output/HTML-CSS"],
+      tex2jax: {
+        inlineMath: [ ['$','$'], ["\\(","\\)"] ],
+        displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
+        processEscapes: true
+      },
+      "HTML-CSS": { availableFonts: ["TeX"] }
+    });
+  </script>
+<script type="text/javascript" 
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js";></script>
+endif::mathjax[]
 endif::latexmath[]
 {docinfo1,docinfo2#}{include:{docdir}/docinfo.html}
 {docinfo,docinfo2#}{include:{docdir}/{docname}-docinfo.html}

Here it is a minimal example using mathematical formulas

Minimal Example
===============

Display beautiful formulas with MathJax like famous latexmath:[$E=mc^2$] or 
the
cumulative distribution function of the normal distribution

[latexmath]
++++
\[
F(x;\mu,\sigma)=\int_{-\infty}^x \frac{1}{\sigma\sqrt{2\pi}} 
e^{-\frac{(x-\mu)^2}{2\sigma^2}}
\]
++++


In order to obtain the MathJax version of the HTML run "asciidoc -a mathjax 
minimal.asciidoc" and you'll get the beautiful math in any modern browser.

I'd like to have this functionality as default for the xhtml11 backend but 
I don't know how to do this without the -a option.

Hope it is useful to you.

Regards
Toni

-- 
You received this message because you are subscribed to the Google Groups 
"asciidoc" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/asciidoc/-/SV98ywSIZKMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/asciidoc?hl=en.

Reply via email to