emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* problems with mathjax CDN and HTML export
@ 2011-11-07 16:02 Giovanni Ridolfi
  2011-11-07 20:47 ` Christian Moe
  0 siblings, 1 reply; 5+ messages in thread
From: Giovanni Ridolfi @ 2011-11-07 16:02 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Jambunathan K


Hello everybody,

I have a problem with HTML export and Mathjax.

On the Mathjax site it is written that:" 
There are two ways to access MathJax: the easiest way is to use the copy
of MathJax available  from our distributed network service at
cdn.mathjax.org,  

[and some lines below: "We recommend using the CDN service"]

but you can also download and install a copy of MathJax on your own server, 
or for use locally on your own hard disk (with no need for network access)."

So I went for the CDN service.
Incidentally, if it worked, we could drop the
http://orgmode.org/mathjax/MathJax.js  support.

In the section "Putting mathematics in a web page" of the 
[[http://www.mathjax.org/docs/1.1/start.html#putting-mathematics-in-a-web-page][Mathjax documentation]]

it is written that: "To put mathematics in your web page, you can use
either  TeX and LaTeX notation or MathML notation or both within the
same page;" 

and this is done putting two scripts in the html file[1] 


"The default math delimiters are $$...$$ and \[...\] for displayed
mathematics, and \(...\) for in-line mathematics."

Now if I try to export to HTML the following file 
--------------------------------------
  -*- mode: org -*-
* mathjax test
:PROPERTIES:
:EXPORT_TITLE:
:EXPORT_FILE_NAME: 000000-bbbbb.html
:EXPORT_OPTIONS:  H:3 num:nil toc:nil \n:t @:t ::t |:t ^:t f:nil *:t tags:nil TeX:t LaTeX:nil skip:t p:nil  author:nil  email:nil  creator:nil timestamp:t
:END:
#+STYLE: <script type="text/x-mathjax-config"> MathJax.Hub.Config({   tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script>
#+STYLE: <script type="text/javascript"  src="https://d3eoax9i5htok0.cloudfront.net/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
#+MATHJAX: align:"left" mathml:t path:"https://d3eoax9i5htok0.cloudfront.net/mathjax/latest/MathJax.js"
** Test
***  $$
$$
\alpha = \frac{1}{L_{0}} \left( \frac{L_2-L_1}{T_2-T_1} \right) 
= \frac{1}{L_0}\frac{\Delta L}{\Delta T}
$$
*** @$$
@$$
\alpha = \frac{1}{L_{0}} \left( \frac{L_2-L_1}{T_2-T_1} \right) 
= \frac{1}{L_0}\frac{\Delta L}{\Delta T}
@$$
#+END_SRC
*** #+BEGIN_HTML
#+BEGIN_HTML
$$
\alpha = \frac{1}{L_{0}} \left( \frac{L_2-L_1}{T_2-T_1} \right) 
= \frac{1}{L_0}\frac{\Delta L}{\Delta T}
$$
#+END_HTML
*** nothing
u(\alpha) = \delta\alpha =  {
\Bigg(
\left[\frac{-(\Delta L+c)}{L_{0}\cdot (T_1 -T_0)^{2}} \delta T_1 \right]^2 +
---------------------------------------------------------------------------------------------

the math snippets are always "converted" in HTML format e.g.: &alpha; = \frac{1}{L<sub>0</sub>} 
:-(
unless they're inside the #+BEGIN_HTML block.

Is there another way to tell the HTML exporter to copy verbatim the lines inside the 
math delimiters? 

cheers,
Giovanni

[1]
<script type="text/x-mathjax-config"> MathJax.Hub.Config({   tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }); </script>
<script type="text/javascript"  src="https://d3eoax9i5htok0.cloudfront.net/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>

C-h v  org-export-html-mathjax-options :

org-export-html-mathjax-options is a variable defined in `org-html.el'.
Its value is ((path "http://orgmode.org/mathjax/MathJax.js")
 (scale "100")
 (align "center")
 (indent "2em")
 (mathml nil))

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: problems with mathjax CDN and HTML export
  2011-11-07 16:02 problems with mathjax CDN and HTML export Giovanni Ridolfi
@ 2011-11-07 20:47 ` Christian Moe
  2011-11-08 16:09   ` Giovanni Ridolfi
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Moe @ 2011-11-07 20:47 UTC (permalink / raw)
  To: Giovanni Ridolfi; +Cc: emacs-orgmode, Jambunathan K

On 11/7/11 5:02 PM, Giovanni Ridolfi wrote:
> the math snippets are always "converted" in HTML format e.g.:&alpha; = \frac{1}{L<sub>0</sub>}

Do I understand correctly that this is your problem? (Not very clear 
from your long example, which starts with the CDN service.)

If so, I can't reproduce it. Your

$$
\alpha = \frac{1}{L_{0}} \left( \frac{L_2-L_1}{T_2-T_1} \right)
= \frac{1}{L_0}\frac{\Delta L}{\Delta T}
$$

exports verbatim for me, and is correctly formatted.

Yours,
Christian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: problems with mathjax CDN and HTML export
  2011-11-07 20:47 ` Christian Moe
@ 2011-11-08 16:09   ` Giovanni Ridolfi
  2011-11-09  9:09     ` Christian Moe
  0 siblings, 1 reply; 5+ messages in thread
From: Giovanni Ridolfi @ 2011-11-08 16:09 UTC (permalink / raw)
  To: mail; +Cc: emacs-orgmode, Jambunathan K

Christian Moe <mail@christianmoe.com> writes:

Hi Christian, thank you for checking,

> On 11/7/11 5:02 PM, Giovanni Ridolfi wrote:
>> the math snippets are always "converted" in HTML format e.g.:&alpha; = \frac{1}{L<sub>0</sub>}
>
> Do I understand correctly that this is your problem? 
yes.
> (Not very clear
> from your long example, which starts with the CDN service.)
sorry for that

>
> If so, I can't reproduce it. Your
>
> $$
> \alpha = \frac{1}{L_{0}} \left( \frac{L_2-L_1}{T_2-T_1} \right)
> = \frac{1}{L_0}\frac{\Delta L}{\Delta T}
> $$
>
> exports verbatim for me, and is correctly formatted.

I tried. Yes and no.

Yes, You're right. It is exported correctly and correctly formatted
if you export only *this* subheading. The subheading "** $$".

But, if you export the whole subtree, from the 
"* mathjax test " heading, the equation is 
"converted" in HTML format e.g.:&alpha; = \frac{1}{L<sub>0</sub>}

Giovanni

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: problems with mathjax CDN and HTML export
  2011-11-08 16:09   ` Giovanni Ridolfi
@ 2011-11-09  9:09     ` Christian Moe
  2011-11-09 14:56       ` SOLVED " Giovanni Ridolfi
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Moe @ 2011-11-09  9:09 UTC (permalink / raw)
  To: Giovanni Ridolfi; +Cc: emacs-orgmode, Jambunathan K

On 11/8/11 5:09 PM, Giovanni Ridolfi wrote:
> Yes, You're right. It is exported correctly and correctly formatted
> if you export only *this* subheading. The subheading "** $$".
>
> But, if you export the whole subtree, from the
> "* mathjax test " heading, the equation is
> "converted" in HTML format e.g.:&alpha; = \frac{1}{L<sub>0</sub>}
>
> Giovanni

Ah, I see.

The problem is that the "$$" in the subheading is interpreted as an 
unclosed math snippet. (Interesting that it's still exported as a 
heading.) After that, math closes when it should open.

Try closing the subheading: "* $$ $$" and exporting again.

Getting "$$" as a subheading is not quite straightforward, but the 
following will work. Create a user-defined dollar-sign entity (org 
doesn't have one by default):

(setq org-entities-user
    '(("dollar" "\\$" nil "&#36;" "$" "$" "$")))

Now "* \dollar\dollar" should work.

Yours,
Christian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: SOLVED problems with mathjax CDN and HTML export
  2011-11-09  9:09     ` Christian Moe
@ 2011-11-09 14:56       ` Giovanni Ridolfi
  0 siblings, 0 replies; 5+ messages in thread
From: Giovanni Ridolfi @ 2011-11-09 14:56 UTC (permalink / raw)
  To: mail; +Cc: emacs-orgmode

Christian Moe <mail@christianmoe.com> writes:

Hi, Christian,

thank you for cheching again.... well *MY* mistake
was setting the option: 

:EXPORT_OPTIONS:  H:3 num:nil toc:nil \n:t @:t ::t |:t ^:t f:nil *:t
 tags:nil TeX:t LaTeX:nil
                    ^^^^^^
Consequently the LaTeX fragments are "converted" in  HTML format e.g.:
    
     u(&alpha;) = &delta;&alpha; =  {\left(
     \left[\frac{-(&Delta; L+c)}{L<sub>0</sub>&sdot;  [...]

Why not, since I set this option? :-(

Sorry for the noise and thank you again for your time,

Giovanni

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-09 14:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-07 16:02 problems with mathjax CDN and HTML export Giovanni Ridolfi
2011-11-07 20:47 ` Christian Moe
2011-11-08 16:09   ` Giovanni Ridolfi
2011-11-09  9:09     ` Christian Moe
2011-11-09 14:56       ` SOLVED " Giovanni Ridolfi

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).