OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



OJS Plugin: MathJax

The Plugin Gallery is a venue for users of PKP software to share their plugins.

Moderators: jmacgreg, michael, John

Forum rules
If you post a plugin here, please include information on which versions of which applications it is compatible with. Attach a tarball of the plugin (e.g. tar cvzf myPlugin-0.1.tar.gz plugins/generic/myPlugin). Thanks for contributing!

OJS Plugin: MathJax

Postby jmacgreg » Mon Dec 13, 2010 3:54 pm

This plugin installs and enables the MathJax javascript engine for your journal. From the MathJax documentation:

MathJax is an open-source JavaScript display engine for LaTeX and MathML that works in all modern browsers. It was designed with the goal of consolidating the recent advances in web technologies into a single, definitive, math-on-the-web platform supporting the major browsers and operating systems.


You can see the results of installing/enabling this plugin in the screenshot below. I just copy&pasted the demonstration HTML, which included raw LaTeX, from here, and pasted into an HTML galley.

The MathJax library itself is fairly large, so this plugin weighs in at ~17MB. You can download it from here: mathjax 1.0.0.zip.

Author: James MacGregor
Software: OJS, probably also OCS
Versions: 2.3+
Multilingual: only English included

Cheers,
James
Attachments
mathjax.png
screenshot
mathjax.png (164.9 KiB) Viewed 6276 times
jmacgreg
 
Posts: 4190
Joined: Tue Feb 14, 2006 10:50 am

Re: OJS Plugin: MathJax

Postby lightshadow306 » Tue Mar 22, 2011 11:02 am

This plugin is wonderful. Thank you very much. But now there are two problems
1. It does not work while the Citation Markup Assistant being enabled and the issue published.
2. The configure metod for mathjax 1.1 is quit different. So the plugin doesn't work for mathjax 1.1

Hope someone can have solutions.

Best Wishes
lightshadow306
 
Posts: 63
Joined: Wed Nov 05, 2008 8:16 am

Re: OJS Plugin: MathJax

Postby jmacgreg » Fri Mar 25, 2011 2:50 pm

Hi lightshadow,

Thanks for the notes! I'll try and see if I can find a fix for both issues in the near future, time depending. If you don't see anything in the next week, please feel free to remind me here.

Cheers,
James
jmacgreg
 
Posts: 4190
Joined: Tue Feb 14, 2006 10:50 am

Re: OJS Plugin: MathJax

Postby lightshadow306 » Wed Apr 27, 2011 2:32 am

jmacgreg wrote:Hi lightshadow,

Thanks for the notes! I'll try and see if I can find a fix for both issues in the near future, time depending. If you don't see anything in the next week, please feel free to remind me here.

Cheers,
James

Dear James,
Do you get any progress on mathjax plugin for MathJax verion 1.1 ?
Thank you very much.

Light Shadow
lightshadow306
 
Posts: 63
Joined: Wed Nov 05, 2008 8:16 am

Re: OJS Plugin: MathJax

Postby jmacgreg » Fri Apr 29, 2011 2:16 pm

Hi lightshadow,

Not yet, unfortunately -- time's been tight these days. I'll see if I can get to it this weekend, though.

Cheers,
James
jmacgreg
 
Posts: 4190
Joined: Tue Feb 14, 2006 10:50 am

Re: OJS Plugin: MathJax

Postby hkoers » Mon May 02, 2011 4:59 am

Hi, my name is Hylke Koers and I work on MathJax. I saw this thread and just wanted to comment that MathJax 1.1 comes with a CDN service, which makes it very easy to integrate into an existing website or platform. In most cases, adding a single line of code into the HTML header is all you need to start including MathML or LaTeX in your documents. More information and installation instructions can be found at http://www.mathjax.org/2011/03/15/news/ ... 1-release/

I hope this is useful, and please feel free to contact us through the contact form on mathjax.org if you have questions.
hkoers
 
Posts: 1
Joined: Mon May 02, 2011 4:51 am

Re: OJS Plugin: MathJax

Postby jmacgreg » Wed May 04, 2011 12:39 pm

Hi Hylke,

That's great news! I'll definitely be looking into this. If this is the case, we can most likely add the plugin to the OJS codebase so it's available to users by default, since we wouldn't need to ship the entire MathJax library.

Thanks for letting us know,
James
jmacgreg
 
Posts: 4190
Joined: Tue Feb 14, 2006 10:50 am

Re: OJS Plugin: MathJax

Postby lightshadow306 » Sun Jun 19, 2011 7:12 pm

Dear All
any progress on MathJax 1.1 ?
Try to modified the plugin with new configuration
<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?config=TeX-AMS-MML_HTMLorMML">
</script>
but it failed.
The tex2jax options doesn't work.
Thank you very much. I think this plugin is very import for mathematical journals.
lightshadow306
 
Posts: 63
Joined: Wed Nov 05, 2008 8:16 am

Re: OJS Plugin: MathJax

Postby jmacgreg » Wed Jun 22, 2011 10:07 pm

Hi folks,

I've modified the original mathjax plugin to now use the mathjax CDN service -- so all you need to do is install/upgrade to the plugin provided in this post, and not worry about uploading the entire mathjax library. Lightshadow, would you mind testing this? If it works well for you, I'll include it in the core OJS codebase.

(NB: this file should work with OJS 2.3+. Not tested on OCS or OJS 2.2.x.)

Cheers,
James
Attachments
mathjax.tar.gz
Mathjax plugin version 1.1
(9.11 KiB) Downloaded 271 times
jmacgreg
 
Posts: 4190
Joined: Tue Feb 14, 2006 10:50 am

Re: OJS Plugin: MathJax

Postby lightshadow306 » Thu Jun 23, 2011 7:50 am

jmacgreg wrote:Hi folks,

I've modified the original mathjax plugin to now use the mathjax CDN service -- so all you need to do is install/upgrade to the plugin provided in this post, and not worry about uploading the entire mathjax library. Lightshadow, would you mind testing this? If it works well for you, I'll include it in the core OJS codebase.

(NB: this file should work with OJS 2.3+. Not tested on OCS or OJS 2.2.x.)

Cheers,
James


Dear James,
I glad to test the new plugin. I have read your new code. You add the lines
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?co
nfig=TeX-AMS-MML_HTMLorMML">
</script>
<!-- / MathJax plugin -->';
This seems convinent for users, but in fact, it does not. My reasons are
1. It is not consistant with MathJax 1.0 and our custom.
(1) In mathjax 1.0, we use $,,,$ or $$....$$ as math delimiters, but use \(...\) and \[....\] as math delimiters in MathJax 1.1. That means we have to modify our metadata of every old article. By the way, mathematicans seem prefer $..$ and $$....$$ rather than \(...\) and \[....\] .
(2) The way to solve the conflicts is add somelines like
<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>
but it doens't seem to work on OJS ( it works on wordpress, moodle....)
2. The plugins did not load at host's mainpage and the reference page.

I have try many possibilities, but I did find a correct solution. You will be appreciated very much if you can find the solution.
My Best Wishes
lightshadow306
 
Posts: 63
Joined: Wed Nov 05, 2008 8:16 am

Re: OJS Plugin: MathJax

Postby lightshadow306 » Thu Jun 23, 2011 8:27 pm

Dear James
Let me state more details.
I try to add some lines to the old MathJaxPlugin.inc.php as following
=========================================
$mathjaxconfig=' <!-- MathJax Config -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ["$","$"], ["\\(","\\)"] ],
displayMath: [ ["$$","$$"], ["\\[","\\]"] ],
processEscapes: true
}
});
</script>
<!-- / MathJax plugin Config -->';

$mathjaxScript = ' <!-- MathJax plugin -->
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<!-- / MathJax plugin -->';

$templateManager->assign('additionalHeadData', $additionalHeadData."\n" .$mathjaxconfig."\n".
$mathjaxScript);
===================

According to the document of MathJax V1.1
This will enable us to use both "$..$" and " \(..\)" as math delimiters, but actually it make " \(..\)" and "\[...\]" fail to work.
one more problem is that "\" is automatically deleted in the Reference part. ( article/view/articleNO. )
lightshadow306
 
Posts: 63
Joined: Wed Nov 05, 2008 8:16 am

Re: OJS Plugin: MathJax

Postby jmacgreg » Fri Jun 24, 2011 10:48 am

Hi lightshadow,

Any chance you could email me an example article galley to test this with? Please send one or two to jmacgreg at gmail dot com (and include "mathjax" in the subject line so I know what it's about).

Cheers,
James
jmacgreg
 
Posts: 4190
Joined: Tue Feb 14, 2006 10:50 am

Re: OJS Plugin: MathJax

Postby jqj » Fri Jul 15, 2011 11:15 am

What I found was that one extra level of backslashing was needed in the source code in my OJS 2.3.5 setup. MathJaxPlugin.inc.php becomes

Code: Select all
$mathjaxconfig=' <!-- MathJax Config -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
    tex2jax: {
        inlineMath: [ ["$","$"], ["\\\\(","\\\\)"] ],
        displayMath: [ ["$$","$$"], ["\\\\[","\\\\]"] ],
        processEscapes: true
    }
});
</script>
<!-- / MathJax plugin Config -->';

However, I don't think it is a good idea for the plugin to default to using '$' as inlineMath delimiters. Granted that most mathematicians use "$" rather than "\(" when writing .tex files, Lamport says they're wrong. And it is fairly likely that a dollar sign will occur elsewhere in your HTML code outside of an intentional pair delimiting a LaTeX expression, with a dysfunctional web page as the result. I would prefer to see the plugin distributed with a comment suggesting how it can be modified to change the configuration, but with a default that simply uses the standard mathjax-preferred http://cdn.mathjax.org/mathjax/latest/M ... _HTMLorMML configuration.

If James wanted to be really fancy he could of course offer a configuration page as part of the plugin that would allow setting the delimiters on a per-journal basis.
jqj
 
Posts: 15
Joined: Wed Dec 23, 2009 2:05 pm

Re: OJS Plugin: MathJax

Postby mcwilson » Tue Jul 22, 2014 10:23 pm

I am using OJS 2.3+ (how do I check exactly?). The plugin version I have was borrowed from another journal, and it worked last year. Now does not display LaTeX in abstracts, etc, any more. I see that MathJax is now up to version 2.4.

Will this plugin be updated? Does it need to be? Is there another solution?

Where is the official download site for this plugin's latest version? The one given in an earlier post in this thread no longer exists.

Any help will be appreciated.
mcwilson
 
Posts: 9
Joined: Wed Dec 19, 2012 3:52 pm


Return to Plugin Gallery

Who is online

Users browsing this forum: No registered users and 2 guests

cron