Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Math in xhtml11 using MathJax
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Toni Cebrián  
View profile  
 More options Oct 24 2012, 4:57 pm
From: Toni Cebrián <ance...@gmail.com>
Date: Wed, 24 Oct 2012 13:57:58 -0700 (PDT)
Local: Wed, Oct 24 2012 4:57 pm
Subject: [PATCH] Math in xhtml11 using MathJax

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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lex Trotman  
View profile  
 More options Oct 24 2012, 7:53 pm
From: Lex Trotman <ele...@gmail.com>
Date: Thu, 25 Oct 2012 10:53:35 +1100
Local: Wed, Oct 24 2012 7:53 pm
Subject: Re: [PATCH] Math in xhtml11 using MathJax
On 25 October 2012 07:57, Toni Cebrián <ance...@gmail.com> wrote:

Make it unconditional?

If you don't want to make it unconditional, then set the mathjax
attribute in $HOME/.asciidoc/asciidoc.conf

Someone else did some work on Mathjax but never made an official
plugin as I remember, you could search the mailing list.

Cheers
Lex


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David E. Miller  
View profile  
 More options Nov 24 2012, 9:12 pm
From: "David E. Miller" <david.mil...@quaoar.us>
Date: Sat, 24 Nov 2012 18:12:27 -0800 (PST)
Local: Sat, Nov 24 2012 9:12 pm
Subject: Re: [PATCH] Math in xhtml11 using MathJax

Lex and Toni:

The "someone else" is me. The documentation I did on this topic can be
found here:

http://quaoar.us:8080/mathjax.html

I have not had any time to do more with this. Also, I am not confident in
my ability to
create a plug-in for this capability. This is the main reason that I did
not follow up
in order to provide a plug-in. In my opinion the ability to use this
MathJax option
for rendering mathematics notation using LaTeX formulas would be useful and
further extend the capabilities of Asciidoc. However, I lack the know-how
and the
time to acquire it to  make this an easy to use option in the form of a
plug-in, etc.
in way that would allow Asciidoc users to use this feature easily. I hope
that someone
who has the time and interest in helping me with this will reply so that
MathJax
is an option  available for Asciidoc users that does not require manually
editing
config files as I did in the documentation of the link above. By the way,
my
recollection is that I was able to get this to work as well with the slidy
option.

Best wishes.

David Miller


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »