jsMath (http://www.math.union.edu/~dpvc/jsMath/ jsMath) is an alternative way to render math and it is very different from png based approach (and IMHO superior). While the later was implemented for SMF with mimetex extension (http://custom.simplemachines.org/mods/index.php?mod=1111) there is no jsMath plugin.
I found the way to modify Subs.php (http://weyl.math.toronto.edu/Subs.php.txt) to use jsMath (sure it requires jsMath installation) but I am neither mod developer nor have any intension to become one, so this snippet is for grabs
See in action (http://weyl.math.toronto.edu/bulletinboard/index.php?topic=4.0) (the second post)
Checked with SMF 2 RC2
I'm curious. Surely you need another change to Subs.php to actually make it work? Or is it a change to the mod you've indicated?
Quote from: Arantor on November 23, 2009, 02:31:33 PM
I'm curious. Surely you need another change to Subs.php to actually make it work? Or is it a change to the mod you've indicated?
It is the
only change I made in plain vanilla SMF 2 RC2 to hookup javascript jsMath/easy/load.js which loads the whole jsMath machinery to render math formulae like $$\int xdx $$ (display math) or $x^2$ (inline math). But mimetex plugin also is not a standalone as it uses mimetex.cgi or newer mathtex.cgi which in turn loads latex and dvipng execs to produce png images instead of math formulae
Victor
That's the bit I don't get. Reading the docs of jsMath seems to indicate it needed to be attached to a span or div of class math, which AFAIK isn't in SMF by default.
Quote
seems to indicate it needed to be attached to a span or div of class math
Actually not. There are plenty ways to load jsMath, the easiest is through load.js
weyl.math.toronto.edu/bulletinboard/jsMath/easy/load.js
is what I use (it is highly configurable). So if you get any html page, include script loading then you are done:
as jsMath.js (the main workhorse) sees $$.... $$ or $...$ it renders inside
F.e. for wordpress there is no jsMath plugin but there is general use wp-hook plugin which can load any script - in particular this one.
For mediawiki there is JsMath plugin which does the same
I managed to insert it in CMS SilversStripe CMS - the same way (for special kind of pages only)
http://weyl.math.toronto.edu/wordpress/?p=293 just some links
Victor
Ah, my bad, I missed that. I think I'd have it set up to explicitly use a tag construction were I to make a mod of this, and have a button on the editor, for [math]. Just I can see plenty of instances where $ and $$ might be used otherwise.
Quote from: Arantor on November 23, 2009, 03:25:29 PM
Ah, my bad, I missed that. I think I'd have it set up to explicitly use a tag construction were I to make a mod of this, and have a button on the editor, for [math]. Just I can see plenty of instances where $ and $$ might be used otherwise.
Yes, if you are talking about general use forum. Then we edit load.js
processSlashParens: 1, // process \(...\) in text?
processSlashBrackets: 1, // process \[...\] in text?
processDoubleDollars: 1, // process $$...$$ in text?
processSingleDollars: 1, // process $...$ in text?
processLaTeXenvironments: 0, // process \begin{xxx}...\end{xxx} outside math mode?
fixEscapedDollars: 0, // convert \$ to $ outside of math mode?
doubleDollarsAreInLine: 0, // make $$...$$ be in-line math?
allowDisableTag: 1, // allow ID="tex2math_off" to disable tex2math?
//
// If you want to use your own custom delimiters for math instead
// of the usual ones, then uncomment the following four lines and
// insert your own delimiters within the quotes. You may want to
// turn off processing of the dollars and other delimiters above
// as well, though you can use them in combination with the
// custom delimiters if you wish. See the tex2math documentation
// for more details.
//
//customDelimiters: [
// '[math]','[/math]', // to begin and end in-line math
// '[display]','[/display]' // to begin and end display math
and disable $ and $$ as delimiters (just replace 1 by 0) and allow \( \) \[ \] instead or uncomment
'[math]','[/math]', // to begin and end in-line math
'[display]','[/display]' // to begin and end display math
If we want to be able to use $ as Dollar but allow $ as a math delimiter we enable EscapedDollar, so \$ will be a dollarsign (displayed as $) not math delimiter while $ will be a math delimiter (this is a standard way of TeX)
Victor