Re: [Orgmode] MathJax is now the default for HTML math
Jan Böcker writes: > Since I read the announcement this morning, I have been playing with > MathJax. I found that when an HTML file on the local hard disk uses > MathJax from the web, MathJax reverts to image fonts in Firefox (this is > caused by a security feature of Firefox and mentioned in the MathJax > FAQ). Using a local MathJax installation in a subdirectory fixes this. > > Most of my time was spent messing around with XULRunner to load the > exported HTML page, wait until MathJax has done its magic, then > serialize the result back to XHTML. > > And replace the file:// URLs pointing to the fonts of my local MathJax > installation with data: URIs, thus embedding the fonts within the HTML > file itself, just because I can. > > The result is a single HTML file which does not require JavaScript to be > viewed (and incurs no delay while the math is being rendered). However, > as no MathJax code is present, the zoom and view source functions of > MathJax are not available. How about doing the same data: URI embedding for images in the HTML exporter? It should be possible to implement it entirely inside Emacs. It would have to be optional, of course. Derek -- Derek Upham s...@blarg.net ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] MathJax is now the default for HTML math
On Aug 17, 2010, at 5:17 PM, Jan Böcker wrote: On 08/17/2010 01:01 PM, Carsten Dominik wrote: On Aug 17, 2010, at 12:44 PM, Jan Böcker wrote: Static MathJax v0.2 contains org-static-mathjax.el, which integrates it into the Org export process. The comments in that file explain how it can be used. Download it at: http://www.jboecker.de/2010/08/15/staticmathjax.html I have added a note to org-hacks.org in Worg, which should show up when Worg is next exported to HTML on the server. And, since you made it into a nice little package, I think it could go into the contrib directory as well - if you want, of course. - Carsten Feel free to include it! I guess org-static-mathjax.el should go to contrib/lisp and everything else to contrib/scripts/staticmathjax/ ? Maybe add a pointer to contrib/scripts/staticmathjax/README.org in the comments of the lisp file. I have added it thanks. The only modification I made is to initialize your first variable like this: (defcustom org-static-mathjax-app-ini-path (or (expand-file-name "../scripts/staticmatchjax/application.ini" (file-name-directory (or load-file-name buffer-file-name))) "") "Path to \"application.ini\" of the Static MathJax XULRunner application. If you have extracted StaticMathJax to e.g. ~/.local/staticmathjax, set this to ~/.local/staticmathjax/application.ini" :type 'string) This should then point to to the right place in an Org distribution. Thanks! - Carsten ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] MathJax is now the default for HTML math
On 08/17/2010 01:01 PM, Carsten Dominik wrote: > > On Aug 17, 2010, at 12:44 PM, Jan Böcker wrote: > >> Static MathJax v0.2 contains org-static-mathjax.el, which integrates it >> into the Org export process. The comments in that file explain how it >> can be used. >> >> Download it at: >> http://www.jboecker.de/2010/08/15/staticmathjax.html >> >> I have added a note to org-hacks.org in Worg, which should show up when >> Worg is next exported to HTML on the server. > > And, since you made it into a nice little package, I think > it could go into the contrib directory as well - if you want, of course. >> > > - Carsten > Feel free to include it! I guess org-static-mathjax.el should go to contrib/lisp and everything else to contrib/scripts/staticmathjax/ ? Maybe add a pointer to contrib/scripts/staticmathjax/README.org in the comments of the lisp file. -- Jan ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] MathJax is now the default for HTML math
On Aug 17, 2010, at 12:44 PM, Jan Böcker wrote: Static MathJax v0.2 contains org-static-mathjax.el, which integrates it into the Org export process. The comments in that file explain how it can be used. Download it at: http://www.jboecker.de/2010/08/15/staticmathjax.html I have added a note to org-hacks.org in Worg, which should show up when Worg is next exported to HTML on the server. And, since you made it into a nice little package, I think it could go into the contrib directory as well - if you want, of course. - Carsten ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] MathJax is now the default for HTML math
Static MathJax v0.2 contains org-static-mathjax.el, which integrates it into the Org export process. The comments in that file explain how it can be used. Download it at: http://www.jboecker.de/2010/08/15/staticmathjax.html I have added a note to org-hacks.org in Worg, which should show up when Worg is next exported to HTML on the server. -- Jan ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] MathJax is now the default for HTML math
Hi Detlef, Detlef Steuer writes: > I would like the possibility to export to static but nice math in HTML > directly out of org. So, worg alone would be a little far away from > the core, anything else would feel fine. Maybe let's have this on Worg first, then see if people want it "closer" to Org. It seems easier to go that route than the other way around... -- Bastien ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] MathJax is now the default for HTML math
Hi all, Carsten Dominik writes: > The reason why we can make MathJax work without any additional work by > either author or reader is that Bastien has agreed to serve MathJax > from http://orgmode.org/mathjax/MathJax.js. This is brilliant. > However, if many people use this, this will put pressure on his > server, and we have no idea how big the demand will be as time goes > by. We will have to monitor the resulting server load and see how tis > works. If you are going to use math in webpages frequently or on > pages with many views, we are asking you to install your own version > of MathJax on your server - it is as simple as unpacking a zip file. > Detailed instructions will be posted on Worg some time soon. Moreover, if you cannot install MathJax on your server and plan to use the orgmode.org script on a page that will have many views, please just drop me an email saying so -- it will help me monitor the charge on the server. Thanks! -- Bastien ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] MathJax is now the default for HTML math
On Mon, 16 Aug 2010 10:59:05 +0200 Carsten Dominik wrote: > > On Aug 15, 2010, at 3:24 PM, Jan Böcker wrote: > > > I have now published the code used to create the static version: > > http://www.jboecker.de/2010/08/15/staticmathjax.html > > > > Below is a first stab at HTML export integration fresh out of my > > *scratch* buffer (which lacks the possibility to configure this for > > each > > file). > > > > -- Jan > > > > > > (defun jb/static-mathjax-hook-installer () > > "adds jb/static-mathjax-process to the local after-save hook" > > (add-hook 'after-save-hook 'jb/static-mathjax-process nil t)) > > > > (defun jb/static-mathjax-process () > > (let ((app-ini-path "/home/jan/work/staticmathjax/application.ini") > > (output-file-name (concat (file-name-sans-extension > > buffer-file- > > name) > > > > "-static.html"))) > > (call-process "xulrunner" nil nil nil app-ini-path buffer-file-name > > output-file-name "--embed-fonts"))) > > > > (add-hook 'org-export-html-final-hook 'jb/static-mathjax-hook- > > installer) > > > > > Hi, > > should something like this go into org itself, or would it be enough to > put this up on worg, in org-hacks or so? I would like the possibility to export to static but nice math in HTML directly out of org. So, worg alone would be a little far away from the core, anything else would feel fine. But this is not an important opinion, more important where you feel the conceptually correct location is. Detlef > > - Carsten > > signature.asc Description: PGP signature ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] MathJax is now the default for HTML math
On Aug 16, 2010, at 12:09 PM, Jan Böcker wrote: On 08/16/2010 10:59 AM, Carsten Dominik wrote: Hi, should something like this go into org itself, or would it be enough to put this up on worg, in org-hacks or so? - Carsten Hi Carsten, Org-hacks sounds like the appropriate place. It is, after all, exactly that: a hack/proof of concept with some useful applications. I'll update worg as soon as I have written an export hook which is configurable on a per-file basis. Sounds good, thanks1 - Carsten ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] MathJax is now the default for HTML math
On 08/16/2010 10:59 AM, Carsten Dominik wrote: > Hi, > > should something like this go into org itself, or would it be enough to > put this up on worg, in org-hacks or so? > > - Carsten Hi Carsten, Org-hacks sounds like the appropriate place. It is, after all, exactly that: a hack/proof of concept with some useful applications. I'll update worg as soon as I have written an export hook which is configurable on a per-file basis. -- Jan ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] MathJax is now the default for HTML math
On Aug 15, 2010, at 3:24 PM, Jan Böcker wrote: I have now published the code used to create the static version: http://www.jboecker.de/2010/08/15/staticmathjax.html Below is a first stab at HTML export integration fresh out of my *scratch* buffer (which lacks the possibility to configure this for each file). -- Jan (defun jb/static-mathjax-hook-installer () "adds jb/static-mathjax-process to the local after-save hook" (add-hook 'after-save-hook 'jb/static-mathjax-process nil t)) (defun jb/static-mathjax-process () (let ((app-ini-path "/home/jan/work/staticmathjax/application.ini") (output-file-name (concat (file-name-sans-extension buffer-file- name) "-static.html"))) (call-process "xulrunner" nil nil nil app-ini-path buffer-file-name output-file-name "--embed-fonts"))) (add-hook 'org-export-html-final-hook 'jb/static-mathjax-hook- installer) Hi, should something like this go into org itself, or would it be enough to put this up on worg, in org-hacks or so? - Carsten ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] MathJax is now the default for HTML math
I have now published the code used to create the static version: http://www.jboecker.de/2010/08/15/staticmathjax.html Below is a first stab at HTML export integration fresh out of my *scratch* buffer (which lacks the possibility to configure this for each file). -- Jan (defun jb/static-mathjax-hook-installer () "adds jb/static-mathjax-process to the local after-save hook" (add-hook 'after-save-hook 'jb/static-mathjax-process nil t)) (defun jb/static-mathjax-process () (let ((app-ini-path "/home/jan/work/staticmathjax/application.ini") (output-file-name (concat (file-name-sans-extension buffer-file-name) "-static.html"))) (call-process "xulrunner" nil nil nil app-ini-path buffer-file-name output-file-name "--embed-fonts"))) (add-hook 'org-export-html-final-hook 'jb/static-mathjax-hook-installer) ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] MathJax is now the default for HTML math
On Aug 15, 2010, at 12:16 AM, Jan Böcker wrote: On 08/14/2010 10:59 PM, Carsten Dominik wrote: Hi Jan, can you expand a bit on why this is interesting to do? What are the advantages? Thanks! - Carsten Advantages are: - The user is not required to have JavaScript enabled - In some cases, there is a speed advantage, because there is no rendering stage. This is especially noticeable on high-latency connections when the MathJax files are not already cached. - Fonts can be embedded into the HTML file itself, so it feels more 'document-like' (no need to move additional files around) - The approach might be interesting for HTML email, because it would require neither JavaScript nor attachments Of course, there are disadvantages too: - No interactive MathJax features (zoom, view source, switch rendering backend) - no fallback to image fonts (although AFAIK, all current versions of major browsers support CSS3 custom fonts) - slightly different spacing and font sizes in non-Firefox browsers - if fonts are embedded within the HTML file: * IE will not show the correct font (but in my test the formatting was still correct and readable) * The HTML file will be larger (my small example grew by 436 KB). Bandwidth is wasted because the fonts are base64-encoded. Hi Jan, thanks for these explanations. - Carsten I would not recommend this for regular publishing on the web. As long as JavaScript is enabled (as it is in most cases), the disadvantages outweigh the advantages. It might come in handy if you want to send someone a single file (although you can always use PDF for that) or if you want to provide an alternative for users who have JavaScript disabled. Ideally, there would be some sort of graceful degradation, so that users without JavaScript see the non-JS version, but if JavaScript is enabled, the math gets re-rendered and all MathJax features are available. I have not explored the feasibility of that. On 08/14/2010 10:39 PM, Detlef Steuer wrote: Could you post the org file to give dummies like me a head start? Especially the serializing back to HTML? How is it done? I have attached the (very simple) example org file to this email. The first example is the result of exporting this file with C-c C-e h (like Carsten said, it Just Works). The second example is the result of processing the first one with a xulrunner application I hacked together (which is independent of emacs). I'll try to get that application into a publishable form tomorrow (remove hard-coded values, make embedding fonts into the HTML file optional, etc). My aim is to provide an elisp function to be called from an export hook which makes the appropriate call to create the non-JS version. -- Jan - Carsten ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] MathJax is now the default for HTML math
On 08/14/2010 10:59 PM, Carsten Dominik wrote: > Hi Jan, > > can you expand a bit on why this is interesting to do? What are the > advantages? > > Thanks! > > - Carsten Advantages are: - The user is not required to have JavaScript enabled - In some cases, there is a speed advantage, because there is no rendering stage. This is especially noticeable on high-latency connections when the MathJax files are not already cached. - Fonts can be embedded into the HTML file itself, so it feels more 'document-like' (no need to move additional files around) - The approach might be interesting for HTML email, because it would require neither JavaScript nor attachments Of course, there are disadvantages too: - No interactive MathJax features (zoom, view source, switch rendering backend) - no fallback to image fonts (although AFAIK, all current versions of major browsers support CSS3 custom fonts) - slightly different spacing and font sizes in non-Firefox browsers - if fonts are embedded within the HTML file: * IE will not show the correct font (but in my test the formatting was still correct and readable) * The HTML file will be larger (my small example grew by 436 KB). Bandwidth is wasted because the fonts are base64-encoded. I would not recommend this for regular publishing on the web. As long as JavaScript is enabled (as it is in most cases), the disadvantages outweigh the advantages. It might come in handy if you want to send someone a single file (although you can always use PDF for that) or if you want to provide an alternative for users who have JavaScript disabled. Ideally, there would be some sort of graceful degradation, so that users without JavaScript see the non-JS version, but if JavaScript is enabled, the math gets re-rendered and all MathJax features are available. I have not explored the feasibility of that. On 08/14/2010 10:39 PM, Detlef Steuer wrote: > Could you post the org file to give dummies like me a head start? > Especially the serializing back to HTML? How is it done? I have attached the (very simple) example org file to this email. The first example is the result of exporting this file with C-c C-e h (like Carsten said, it Just Works). The second example is the result of processing the first one with a xulrunner application I hacked together (which is independent of emacs). I'll try to get that application into a publishable form tomorrow (remove hard-coded values, make embedding fonts into the HTML file optional, etc). My aim is to provide an elisp function to be called from an export hook which makes the appropriate call to create the non-JS version. -- Jan * Testing MathJax: $2^4 = 16 \le 16$ \( exp(z) = \sum_{k=0}^\infty \frac{z^k}{k!} \) ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] MathJax is now the default for HTML math
On Aug 14, 2010, at 9:37 PM, Jan Böcker wrote: On 08/14/2010 08:09 AM, Carsten Dominik wrote: From now on, the default settings will use the incredible MathJax library to display math in exported HTML. If you had never turned on LaTeX snipped math publishing, this will now magically work all by itself. Yes, indeed it does! Since I read the announcement this morning, I have been playing with MathJax. I found that when an HTML file on the local hard disk uses MathJax from the web, MathJax reverts to image fonts in Firefox (this is caused by a security feature of Firefox and mentioned in the MathJax FAQ). Using a local MathJax installation in a subdirectory fixes this. Most of my time was spent messing around with XULRunner to load the exported HTML page, wait until MathJax has done its magic, then serialize the result back to XHTML. Hi Jan, can you expand a bit on why this is interesting to do? What are the advantages? Thanks! - Carsten And replace the file:// URLs pointing to the fonts of my local MathJax installation with data: URIs, thus embedding the fonts within the HTML file itself, just because I can. The result is a single HTML file which does not require JavaScript to be viewed (and incurs no delay while the math is being rendered). However, as no MathJax code is present, the zoom and view source functions of MathJax are not available. I have put an example online. Normal org-mode export using MathJax from orgmode.org: http://www.jboecker.de/2010/08/14/mathjax-example.html Single-file no-javascript version: http://www.jboecker.de/2010/08/14/mathjax-example-nojs.html Internet Explorer will not use the correct font, AFAIK because it only supports the EOT fonts (MathJax uses OTF for other browsers), and in this case also because I embedded the fonts using data: URIs and IE limits the size of data: URIs to 32 KB. In browsers other than Firefox (I tested with Firefox and Opera), the font size and spacing will differ slightly between the two versions. If people are interested, I can try to make the program take the name of a file to operate on as a command line argument, so this could be run as part of an org-mode export process or something. Of course, the embedding of fonts in data: URIs would be optional. I am really, really excited about this change. Using MathJax makes Org-mode a tool without peer for scientific note taking, I believe. It will also drastically improve the quality of printed web pages, because the web pages will not use fixed-resolution images, but scaleable fonts. And don't forget that on modern high resolution displays, it is common to zoom in just to be able to decipher math in images, especially if you want sub- and superscripts to be legible. -- Jan - Carsten ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] MathJax is now the default for HTML math
On 08/14/2010 08:09 AM, Carsten Dominik wrote: > From now on, the default settings will > use the incredible MathJax library to display math in > exported HTML. If you had never turned on LaTeX snipped > math publishing, this will now magically work all by itself. Yes, indeed it does! Since I read the announcement this morning, I have been playing with MathJax. I found that when an HTML file on the local hard disk uses MathJax from the web, MathJax reverts to image fonts in Firefox (this is caused by a security feature of Firefox and mentioned in the MathJax FAQ). Using a local MathJax installation in a subdirectory fixes this. Most of my time was spent messing around with XULRunner to load the exported HTML page, wait until MathJax has done its magic, then serialize the result back to XHTML. And replace the file:// URLs pointing to the fonts of my local MathJax installation with data: URIs, thus embedding the fonts within the HTML file itself, just because I can. The result is a single HTML file which does not require JavaScript to be viewed (and incurs no delay while the math is being rendered). However, as no MathJax code is present, the zoom and view source functions of MathJax are not available. I have put an example online. Normal org-mode export using MathJax from orgmode.org: http://www.jboecker.de/2010/08/14/mathjax-example.html Single-file no-javascript version: http://www.jboecker.de/2010/08/14/mathjax-example-nojs.html Internet Explorer will not use the correct font, AFAIK because it only supports the EOT fonts (MathJax uses OTF for other browsers), and in this case also because I embedded the fonts using data: URIs and IE limits the size of data: URIs to 32 KB. In browsers other than Firefox (I tested with Firefox and Opera), the font size and spacing will differ slightly between the two versions. If people are interested, I can try to make the program take the name of a file to operate on as a command line argument, so this could be run as part of an org-mode export process or something. Of course, the embedding of fonts in data: URIs would be optional. > I am really, really excited about this change. Using MathJax makes > Org-mode > a tool without peer for scientific note taking, I believe. It will > also drastically improve the quality of printed web pages, because > the web pages will not use fixed-resolution images, but scaleable fonts. And don't forget that on modern high resolution displays, it is common to zoom in just to be able to decipher math in images, especially if you want sub- and superscripts to be legible. -- Jan ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode