emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* latex fragments, dvipng and mathjax
@ 2011-03-08 18:59 Nick Dokos
  2011-03-08 20:16 ` Nick Dokos
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Dokos @ 2011-03-08 18:59 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: nicholas.dokos

I had not played with latex fragments recently (= ever since MathJax
became the default back in August 2010 and probably from some time
before that), so based on my previous dvipng-based knowledge, I made an
ill-informed comment on IRC. Nicolas Goaziou corrected me and pointed
out that the default is now MathJax, so I went off and tried things
out. I tried with MathJax from the orgmode site, but I also downloaded
the stable 1.0.x version (and the new otf fonts) and the beta 1.1
version (which already includes the new otf fonts).

I tried it on the following org file (commenting/uncommenting options
lines for the various runs:

--8<---------------cut here---------------start------------->8---
#+OPTIONS: LaTeX:t
##+OPTIONS: LaTeX:dvipng
##+MATHJAX: align:"left" mathml:t
##+MATHJAX: align:"left" mathml:t path:"/home/nick/lib/mathjax/MathJax/MathJax.js"
#+MATHJAX: align:"left" mathml:t path:"/home/nick/lib/mathjax/mathjax-MathJax-20e0cf6/MathJax.js"


* Euler

\[
\int_0^\infty e^{-x^2} dx = {{\sqrt{\pi}} \over {2}}
\]

\[
e^{i\pi} = -1
\]
--8<---------------cut here---------------end--------------->8---

I've put the results of two runs, one with MathJax and one with dvipng, up at

     http://free.linux.hp.com/~nick/euler/euler-mj.html
     http://free.linux.hp.com/~nick/euler/euler-dvipng.html

The different versions of MathJax all looked the same. The one I put up
is the one that gets MathJax from the publicly available orgmode site,
so if you just want to look at it, you don't have to install anything.

There are two obvious differences: 

o the MathJax version has the equations centered, whereas the dvipng version
has them flush left. I have not investigated why that is.

o the dvipng version looks much better to my eye than the MathJax version.

Of course, MathJax has advantages: it's scalable, so when you go to higher
magnifications, you don't get the jaggies that the png images suffer. But
I was wondering whether there is any way I can get prettier output from
MathJax.

Thanks,
Nick

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

* Re: latex fragments, dvipng and mathjax
  2011-03-08 18:59 latex fragments, dvipng and mathjax Nick Dokos
@ 2011-03-08 20:16 ` Nick Dokos
  2011-03-08 22:56   ` Jeff Horn
  2011-03-08 23:58   ` Erik Iverson
  0 siblings, 2 replies; 7+ messages in thread
From: Nick Dokos @ 2011-03-08 20:16 UTC (permalink / raw)
  Cc: nicholas.dokos, emacs-orgmode

[following up on my post...]

One thing that should have helped is to set the mathml option to nil:

--8<---------------cut here---------------start------------->8---
#+MATHJAX: align:"left" mathml:nil path:"/home/nick/lib/mathjax/mathjax-MathJax-20e0cf6/MathJax.js"
--8<---------------cut here---------------end--------------->8---

That forces HTML-CSS output and from what I can see on the mathjax site,
that should improve things - but it doesn't for me, so I'm still not out
of the woods. Maybe MathJax doesn't know where to get the TeX fonts?

Nick

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

* Re: latex fragments, dvipng and mathjax
  2011-03-08 20:16 ` Nick Dokos
@ 2011-03-08 22:56   ` Jeff Horn
  2011-03-08 23:58   ` Erik Iverson
  1 sibling, 0 replies; 7+ messages in thread
From: Jeff Horn @ 2011-03-08 22:56 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode

Another advantage of MathJax:

1) It degrades nicely in browsers without MathML (all webkit browsers)
2) Equations are still copy-and-pasteable into Word, if you're into
that sort of thing.

> That forces HTML-CSS output and from what I can see on the mathjax site,
> that should improve things - but it doesn't for me, so I'm still not out
> of the woods. Maybe MathJax doesn't know where to get the TeX fonts?

I thought MathJax used custom fonts, which is the bulk of the 100 MB
installation, since each glyph is its own image. I could be wrong
about this.

-- 
Jeffrey Horn
http://www.failuretorefrain.com/jeff/

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

* Re: latex fragments, dvipng and mathjax
  2011-03-08 20:16 ` Nick Dokos
  2011-03-08 22:56   ` Jeff Horn
@ 2011-03-08 23:58   ` Erik Iverson
  2011-03-09  2:13     ` Nick Dokos
  1 sibling, 1 reply; 7+ messages in thread
From: Erik Iverson @ 2011-03-08 23:58 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode

On 03/08/2011 02:16 PM, Nick Dokos wrote:
> [following up on my post...]
>
> One thing that should have helped is to set the mathml option to nil:
>
> --8<---------------cut here---------------start------------->8---
> #+MATHJAX: align:"left" mathml:nil path:"/home/nick/lib/mathjax/mathjax-MathJax-20e0cf6/MathJax.js"
> --8<---------------cut here---------------end--------------->8---
>
> That forces HTML-CSS output and from what I can see on the mathjax site,
> that should improve things - but it doesn't for me, so I'm still not out
> of the woods. Maybe MathJax doesn't know where to get the TeX fonts?

Do the examples on mathjax.org look nice to you? And which browser
do you happen to be using for viewing?

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

* Re: latex fragments, dvipng and mathjax
  2011-03-08 23:58   ` Erik Iverson
@ 2011-03-09  2:13     ` Nick Dokos
  2011-03-09  6:55       ` Aankhen
  0 siblings, 1 reply; 7+ messages in thread
From: Nick Dokos @ 2011-03-09  2:13 UTC (permalink / raw)
  To: Erik Iverson; +Cc: nicholas.dokos, emacs-orgmode

Erik Iverson <eriki@ccbr.umn.edu> wrote:

> On 03/08/2011 02:16 PM, Nick Dokos wrote:
> > [following up on my post...]
> >
> > One thing that should have helped is to set the mathml option to nil:
> >
> > --8<---------------cut here---------------start------------->8---
> > #+MATHJAX: align:"left" mathml:nil path:"/home/nick/lib/mathjax/mathjax-MathJax-20e0cf6/MathJax.js"
> > --8<---------------cut here---------------end--------------->8---
> >
> > That forces HTML-CSS output and from what I can see on the mathjax site,
> > that should improve things - but it doesn't for me, so I'm still not out
> > of the woods. Maybe MathJax doesn't know where to get the TeX fonts?
> 
> Do the examples on mathjax.org look nice to you? And which browser
> do you happen to be using for viewing?
> 
> 

Yes - the Cauchy integral formula (as well as the Gauss divergence
theorem further down) on

    http://www.mathjax.org/demos/mathml-samples/

looks fine when HTML-CSS rendering is chosen. When MathML
rendering is chosen, the integral sign is too small. That's
what motivated the mathml:nil effort above, but it didn't pan
out. But even in MathML rendering, the integral sign, even though
small, looks better than the one I posted.

I'm using firefox 3.6.14 on Ubuntu 10.10.

Thanks,
Nick

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

* Re: latex fragments, dvipng and mathjax
  2011-03-09  2:13     ` Nick Dokos
@ 2011-03-09  6:55       ` Aankhen
  2011-03-09 15:55         ` Nick Dokos
  0 siblings, 1 reply; 7+ messages in thread
From: Aankhen @ 2011-03-09  6:55 UTC (permalink / raw)
  To: nicholas.dokos, Erik Iverson, Org-mode ml

On Wed, Mar 9, 2011 at 07:43, Nick Dokos <nicholas.dokos@hp.com> wrote:
> Erik Iverson <eriki@ccbr.umn.edu> wrote:
>> On 03/08/2011 02:16 PM, Nick Dokos wrote:
>> > [snip]
>> > That forces HTML-CSS output and from what I can see on the mathjax site,
>> > that should improve things - but it doesn't for me, so I'm still not out
>> > of the woods. Maybe MathJax doesn't know where to get the TeX fonts?
>>
>> Do the examples on mathjax.org look nice to you? And which browser
>> do you happen to be using for viewing?
>
> Yes - the Cauchy integral formula (as well as the Gauss divergence
> theorem further down) on
>
>    http://www.mathjax.org/demos/mathml-samples/
>
> looks fine when HTML-CSS rendering is chosen. When MathML
> rendering is chosen, the integral sign is too small. That's
> what motivated the mathml:nil effort above, but it didn't pan
> out. But even in MathML rendering, the integral sign, even though
> small, looks better than the one I posted.
>
> I'm using firefox 3.6.14 on Ubuntu 10.10.

FWIW, same here.  Firefox 3.6.15 on Windows 7.  Given that both pages
specify the MathJax_Math font yet only mathjax.org actually looks like
it uses it, you’re probably right about MathJax having trouble finding
the fonts on yours.

I tried a couple other browsers.  IE8 aborts the script after an error
on “Line 1, char 6” (I think that’s because of the nest of CDATA, HTML
comments and JS comments), while Chrome seems to be using the right
font.  So I guess this is a Firefox thing.  The FAQ mentions Firefox’s
same-origin policy in the context of image fonts being used instead of
web fonts.[1] Seems unlikely to be the culprit in this case though.
*shrugs*

Hope this helps narrow it down a little.

Aankhen

[1]: http://www.mathjax.org/resources/faqs/#image-fonts

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

* Re: latex fragments, dvipng and mathjax
  2011-03-09  6:55       ` Aankhen
@ 2011-03-09 15:55         ` Nick Dokos
  0 siblings, 0 replies; 7+ messages in thread
From: Nick Dokos @ 2011-03-09 15:55 UTC (permalink / raw)
  To: Aankhen; +Cc: nicholas.dokos, Org-mode ml

Aankhen <aankhen@gmail.com> wrote:


> FWIW, same here.  Firefox 3.6.15 on Windows 7.  Given that both pages
> specify the MathJax_Math font yet only mathjax.org actually looks like
> it uses it, you’re probably right about MathJax having trouble finding
> the fonts on yours.
> 
> I tried a couple other browsers.  IE8 aborts the script after an error
> on “Line 1, char 6” (I think that’s because of the nest of CDATA, HTML
> comments and JS comments), while Chrome seems to be using the right
> font.  So I guess this is a Firefox thing.  The FAQ mentions Firefox’s
> same-origin policy in the context of image fonts being used instead of
> web fonts.[1] Seems unlikely to be the culprit in this case though.
> *shrugs*
> 
> Hope this helps narrow it down a little.
> 
> Aankhen
> 
> [1]: http://www.mathjax.org/resources/faqs/#image-fonts
> 

Thanks for this! I probably won't be able to try anything out in the
next few days, but I'll probably spend some time during the weekend
on this.

Thanks,
Nick

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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-08 18:59 latex fragments, dvipng and mathjax Nick Dokos
2011-03-08 20:16 ` Nick Dokos
2011-03-08 22:56   ` Jeff Horn
2011-03-08 23:58   ` Erik Iverson
2011-03-09  2:13     ` Nick Dokos
2011-03-09  6:55       ` Aankhen
2011-03-09 15:55         ` Nick Dokos

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).