jsmath plugin by Stephen Gould
Plugin for displaying LaTeX equations using jsMath
Last updated on 2010-01-20. Provides Syntax.
Compatible with DokuWiki 2009-02-14.
Similar to asciimath, asciimathml, format, latex, math, math2.
For convenience, the plugin is available in two different archive formats.
| Download | plugin-jsmath.tar | plugin-jsmath.zip |
|---|
jsMath is a JavaScript library that renders LaTeX in your browser and is required by the jsmath plugin for DokuWiki. Follow the installation instructions. In short:
NOTE: When trying to display latex formulas for the first time, make sure to clear the browser cache. In Firefox, just press 'Ctrl-Shift-R'. Otherwise you'll get frustrated thinking the install didn't go through. Also try adding somewhere in your latex test page this:
~~NOCACHE~~
Once jsmath and jsMath are correctly installed, you can embed LaTeX code into your document.
This will display an equation in block format, on its own line:
<jsmath>\lim_{n\to\infty}\sum_{i=1}^{n} \frac{1}{i}=\infty</jsmath>
Alternatively, the square bracket syntax is completely equivalent:
\[\lim_{n\to\infty}\sum_{i=1}^{n} \frac{1}{i}=\infty\]
The following example will cause jmath to display the formula inline:
<jsm>\lim_{n\to\infty}\sum_{i=1}^{n} \frac{1}{i}</jsm>
Alternatively, the dollar syntax is completely equivalent:
$\lim_{n\to\infty}\sum_{i=1}^{n} \frac{1}{i}$
If you want to contribute to this plugin, go to the project page of this plugin and contact Holger.
Please report your issues to the issue tracker.
Hi,
When asciisvg is installed, jsmath does not work anymore.
Any workaround? Thanks.
Answer: Please report details to the issue tracker. – Holger.
Hello, I recently switched to jsmath plugin (first I had an hack for that). I've noticed that in array environment the new line command (double backslash) is interpreted by DokuWiki and not by jsmath plugin, causing a new line in the source code rather than in the array environment.
Is there anybody else with the same issue?
Thank you, Emanuele
ANSWER: Hi Emanuele, I saw the same thing; if you escape your backslashes, it should work, a la: \\\\
Update: I forgot, also other DokuWiki commands are overwritten before the code is passed to jsmath plugin. In example, with this code
\sigma(c)
I get a copyright symbol in the formula.
I opened a bug ticket in the project page.
I'm not entirely sure where to report this but I thought here might be easiest. I couldn't get jsMath to work for quite awhile and kept getting an index not defined error. The problem comes in line 8 of install_js.php which reads
$jsMathURL = $conf['jsmath'];
when it should really read
$jsMathURL = $conf['jsMath_url'];
This solved the problem. -Marc
Answer: Thanks for reporting that bug, it's fixed now. –Holger.
Hi all,
jsMath sample page works fine, but not in my DokuWiki installation.
test page: http://research.andrefranz.de/doku.php?id=test
jsMath URL: http://research.andrefranz.de/jsMath/
— 2009/11/24 10:05
Answer: There is a new version of the plugin available, which fixes the problem.
Hi all, I installed the jsMath library on my web server, and I can see that it works (I can execute the test cases in jsMath's test/ directory). I've installed the jsmath DokuWiki plugin, and I have configured the URL to the jsMath installation in the JsMath section of the configuration settings.
The result… nothing. Math formulas such as
<jsmath>\lim_{n\to\infty}\sum_{i=1}^{n} \frac{1}{i}=\infty</jsmath>
are inlined, and not displayed properly. There is no error message in the Apache log. It's as if the jsmath plugin had not been installed.
Does anybody have an idea how to fix this? Thanks in advance!
Answer: It should work now. – Holger.
Hi. I have the same problem. I have installed XAMPP in my server.
if I write:
<jsmath>\lim_{n\to\infty}\sum_{i=1}^{n} \frac{1}{i}=\infty</jsmath>
The result is:
\lim_{n\to\infty}\sum_{i=1}^{n} \frac{1}{i}=\infty
— 2009/12/01 12:01
Answer: I ran into the same issue. You have to install the jsMath Image Fonts as noted on the jsMath download page
Hi guys. I also tried to install the latest version jsMath3.6 and jsMath Image Fonts 1.3, I put the fonts to the directory and the whole stuff seems to work, but I am unable to make it work like the posted. I also get the same result like indicated above, and after the HTML page in DokuWiki is generated I even don't see that the jsMath JavaScript was included or called. In Internet Explorer I get the following error:
Details zum Fehler auf der Webseite Benutzer-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) Zeitstempel: Wed, 2 Dec 2009 10:56:00 UTC Meldung: Syntaxfehler Zeile: 1 Zeichen: 1 Code: 0 URI: http://server/dokuwiki/lib/plugins/jsmath/install_js.php
Does anybody have an idea how could I solve this problem?
Hello, I installed the jsMath library on my local DokuWiki installation. I followed this up with the jsmath plugin installation. I updated the URL in the configuration settings also. However, when I try something simple as well - it is not being rendered by jsmath. Locations to which I have installed are as follows :
Directory where jsMath is installed : /Users/vikasm/Sites/dokuwiki/lib/jsMath
URL specified on the configuration page : file:///Users/vikasm/Sites/dokuwiki/lib/jsMath
jsMath library version : 3.6b
jsmath plugin version : 2009-03-31
Error message seen in the Apache logs is as follows :
[Sun Jun 14 08:13:37 2009] [error] [client ::1] PHP Notice: Undefined index: jsmath in /Users/vikasm/Sites/dokuwiki/lib/plugins/jsmath/install_js.php on line 8, referer: http://localhost/~vikasm/dokuwiki/doku.php?id=start&do=show
Could you let me know what I am doing wrong ?
Regards, Vikas
ANSWER You're not doing anything wrong, the error lies on line 8 of your /Users/vikasm/Sites/dokuwiki/lib/plugins/jsmath/install_js.php, where a conf/default.php is referenced; you might either want to comment out lines 7-8 of that file, as so:
/* require('conf/default.php'); $jsMathURL = $conf['jsmath']; */
or replace conf/default.php with ../../../conf/default.php, if you have that file. I solved my problem by entering the path to jsMath in DokuWiki control panel and then commenting out those lines.
Regards, Emanuele Cipolla
Answer2: I replaced 'require' by 'include'. There should not be an error anymore. – Holger.
Hello, I cannot find the place in DokuWiki Configuration Settings page to set the full URL to the jsMath installation. Only the dollar sign option shows up.
thanks for the good job!
ANSWER Please make sure that you have the most recent version installed (at least version 2009-03-06). – Holger
On January 17th 2010, DokuWiki 2009-12-25b “Lemming” :
I installed jsMath (V 3.6c) and jsMath-fonts (Version 1.3), jsMath/test is working. I install and configure the jsmath DokuWiki plugin and… jsmath does not work in the DokuWiki page
I just see \lim_{n\to\infty}\sum_{i=1}^{n} \frac{1}{i}=\infty
jsMath/test loads plugins/noImageFonts.js before jsMath.js. I did the same in DokuWiki jsmath plugin file install_js.php and it worked. Don't know if I did something evil though…
Here is the version I use
<?php // This file reads the configuration of the jsmath plugin // and then installs the jsMath Library on the JavaScript level. // It is invoked from script.js // First read default value include('conf/default.php'); $jsMathURL = $conf['jsMath_url']; // Then overwrite with actual value (if present in local.php) include('../../../conf/local.php'); $jsMathURL = $conf['plugin']['jsmath']['jsMath_url']; ?> document.write('<script type="text/javascript">jsMath = {Controls: {cookie: {scale: 120}}}</script>'); document.write('<script type="text/javascript" src="<?php echo($jsMathURL); ?>/plugins/noImageFonts.js"></script>'); document.write('<script type="text/javascript" src="<?php echo($jsMathURL); ?>/jsMath.js"></script>'); function installJsMath() { jsMath.Process(document); } addInitEvent(installJsMath);
– Thanks, this is included in the new version 2010-01-20. I wonder why it worked for me, though. Holger.
On DokuWiki 2008-05-05. jsMath returns warnings. It seems it has some conflicts with DokuWiki. See following:
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in C:\DokuWikiStick\dokuwiki\lib\plugins\syntax.php on line 134 Warning: array_merge() [function.array-merge]: Argument #1 is not an array in C:\DokuWikiStick\dokuwiki\lib\plugins\syntax.php on line 134 Warning: array_merge() [function.array-merge]: Argument #1 is not an array in C:\DokuWikiStick\dokuwiki\lib\plugins\syntax.php on line 134
I think this was an error in getAllowedTypes(), now fixed.
It works now. Thank you.
Then trying to clear cache, DokuWiki return this error message:
“It looks like jsMath failed to set up properly (error code -7). I will try to keep going, but it could get ugly.”
What could be an error?
This really works very nicely for equations and formulae, but when I enter a pmatrix (for instance) it isn't displayed properly since it is between span tags, not div tags. I see from the render function that there is a div-tag possibility (if $match is not true), but I can't figure out how to make that happen. Can someone please tell me how to get my matrices to display correctly?
syntax.php in two parts seems to be the way to go to get the jsmath text enclosed in either div or span tags, depending…block, for example.
between the <jsm> and </jsm> boundaries but my regexp to do so isn't yet correct.<jsm>\n to open and \n<jsm> to close. This works for me, and makes some intuitive sense: LaTeX math expressions that are in-line (no cr/lf) between tags are inline , and those where the <jsm> and </jsm> tags appear on line preceding and following the expression are block in div tags in HTML.register–call me duckedape and write to me at laposte dot net if you wish