|
Cookbook /
JsMath-TalkThe tex isn't processing ...The classic problem: Even with the default skin jsMath didn't work -- The short answer is that you will need to change the template file Solution 1: easyload with header This recipe adds a header to your skin template that tells pmwiki
<SCRIPT SRC="pub/jsMath/easy/load.js"> </SCRIPT> So your skin.tmpl file should look like OTHER STUFF
<head>
OTHER STUFF
<SCRIPT SRC="pub/jsMath/easy/load.js">
</SCRIPT>
</head>
If this doesn't work (it should), open the load.js file and make sure that Solution 2: Autoload with footer The page code generated by my wiki was indeed lacking the footer code<!--HTMLFooter-->
<script>
jsMath.Autoload.Check();
jsMath.Process(document);
</script>
I just added all five lines right above the </body> tag in the skin template Why doesn't jsmath work with the default skin!??The original version of the code did not require the skin to load the HTMLFooter.
$HTMLHeaderFmt['jsMathstuff'] =
'
<SCRIPT>
jsMath = {
Controls: {cookie: {scale: 133}},
Autoload: {
loadFonts: ["msam10","msbm10"],
loadFiles: "extensions/AMSsymbols.js"
},
Font: {Message: function () {}}
}
</SCRIPT>
<SCRIPT SRC="JSMathUrl/plugins/autoload.js"></SCRIPT>
<SCRIPT>
window.onload = function () {
jsMath.Autoload.Check();
jsMath.Process(document);
}
</SCRIPT>
';
Pm suggested to change the code as shown below.
$HTMLHeaderFmt['jsMath'] = '
<script> jsMath = {Controls: {cookie: {scale: 120}}} </script>
<script src="$JSMathUrl/plugins/autoload.js"></script>
';
$HTMLFooterFmt['jsMath'] = '
<script>
jsMath.Autoload.Check();
jsMath.Process(document);
</script>
';
The original code above is sloppy, and Pm's was in improvement. Config file -- remember to use jsMath instead of jsmathI was having trouble getting the tex to process until I changed
to
Now it seems to be working. This was on a FreeBSD 6.2 server. Maintaining math mode across linesThere is an error in the jsmath cookbook that means displayed math // This line gives you LaTeX $$ $$ display equations in the center
Markup('{$$', '<{$',
'/\\{\\$\\$(.*?)\\$\$\\}/e',
"Keep('<div class=\"math\">'.PSS('$1').'</div>')");
// This line gives you $ $ equations in line. You can then use
// \displaystyle as normal to get pretty print equations inline.
Markup('{$', 'directives',
'/\\{\\$(.*?)\\$\\}/e',
"Keep('<span class=\"math\">'.PSS('$1').'</span>')");
with // This line gives you LaTeX $$ $$ display equations in the center
Markup('{$$', '<{$',
'/\\{\\$\\$((.|\\n)*?)\\$\$\\}/e',
"Keep('<div class=\"math\">'.PSS('$1').'</div>')");
// This line gives you $ $ equations in line. You can then use
// \displaystyle as normal to get pretty print equations inline.
Markup('{$', 'directives',
'/\\{\\$((.|\\n)*?)\\$\\}/e',
"Keep('<span class=\"math\">'.PSS('$1').'</span>')");
or equally well, replace with Markup('{$$', 'fulltext',
'/\\{\\$\\$(.*?)\\$\$\\}/es',
"Keep('<div class=\"math\">'.PSS('$1').'</div>')");
Markup('{$', '>{$$',
'/\\{\\$(.*?)\\$\\}/es',
"Keep('<span class=\"math\">'.PSS('$1').'</span>')");
This will cause the ... markups to be processed before the text is broken into separate lines. Preserving braces in formulae and allowing multi-line formulaeTo have formula like
Markup('{$$', '<{$var}',
'/\\{\\$\\$(.*?)\\$\\$\\}/es',
"Keep('<div class=\"math\">'.PSS('$1').'</div>')");
Markup('{$', '>{$$',
'/\\{\\$(.*?)\\$\\}/es',
"Keep('<span class=\"math\">'.PSS('$1').'</span>')");
I'm not sure the call to PSS is really needed. emmt January 18, 2010 at 07:58 UTC Print qualityMake sure users install the TeX fonts Unanswered questions and older stuffSymbol for natural numbersI have installed everything and the Tex things looks really great, but how can I insert the symbol for the natural numbers like N=\{1,2,3,4,\ldots \}? So I want the symbol \N \N . comment Do you mean you want blackboard math for N, i.e ℕ ? TeX not processingI downloaded the jsMath packages (jsMath-3.4.zip and jsMath-fonts-1.3.zip), and unzipped them into /PmWiki/pub/jsMath/. I also downloaded the file jsMath.php into /PmWiki/cookbook/jsMath.php, and added the line 'include_once('cookbook/jsmath.php');' to /PmWiki/local/config.php. In the editor, I get the \sqrt{n} icon. However, when I insert an equation, I just get the TeX syntax for it. I can see the equation 5 \sqrt{n} - \alpha properly on my browser. Any idea what is going wrong? What skin are using? I had exactly the same problem using the beeblebrox skin. Using the default or for example monobook everything works fine... I have run into the same problem with other skins - getting just lines of tex. Is the source of this particular problem known yet? Is there an alternative solution? I have figured out the problem -- essentially, the jsMath package relies on the skin to include the HTMLFooter directive, but many skins don't do this (Beeblebrox among them). So the solution is to simply add the line "That's it"!? Well, it does not work with the TriadSkin from Hans. That's a pity! Yes, I've checked the procedure twice and the <!--HTMLFooter--> line does exist as well in the template file. Still, it's only the source code shown on the page. Has someone another hint? /VolkerM The original version of the code did not require the skin to load the HTMLFooter. This is a copy of the code that I used originally.
$HTMLHeaderFmt['jsMathstuff'] =
'
<SCRIPT>
jsMath = {
Controls: {cookie: {scale: 133}},
Autoload: {
loadFonts: ["msam10","msbm10"],
loadFiles: "extensions/AMSsymbols.js"
},
Font: {Message: function () {}}
}
</SCRIPT>
<SCRIPT SRC="JSMathUrl/plugins/autoload.js"></SCRIPT>
<SCRIPT>
window.onload = function () {
jsMath.Autoload.Check();
jsMath.Process(document);
}
</SCRIPT>
';
Pm suggested to change the code as shown below.
$HTMLHeaderFmt['jsMath'] = '
<script> jsMath = {Controls: {cookie: {scale: 120}}} </script>
<script src="$JSMathUrl/plugins/autoload.js"></script>
';
$HTMLFooterFmt['jsMath'] = '
<script>
jsMath.Autoload.Check();
jsMath.Process(document);
</script>
';
The original code above is sloppy, and Pm's was in improvement. However it did require that the skin load the HTMLFooter. Sorry for this disadvantage. Hello, could someone please explain to me how to get the boldsysmbol extension to work with this markup? I tried to follow the instructions, but I can't get it to work. Thanks a lot! June 6, 2007, MS Dollar signI need to use a pair of dollar signs to indicate an excel cell. The usual markup [= ...put the dollars here... =] does not work in this instance. How can I do this without resorting to complex latex formulas involving a lot of \$? Thank you Sandboxx^3 \int_i^k x^2 Equation:
\sum_{i=0}^k x^2
Another:
\sum_{i=0}^k x^2 \mathcal N \mathrm{corr}(X,Y)= \frac{\displaystyle \sum_{i=1}^n(x_i-\overline x)(y_i-\overline y)} {\displaystyle\biggl[\sum_{i=1}^n(x_i-\overline x)^2 \sum_{i=1}^n(y_i-\overline y)^2\biggr]^{1/2}}
T_{sys} \propto \frac{T_{sys}}{\sqrt{\tau B}}
\mathrm{corr}(X,Y)= \frac{\displaystyle \sum_{i=1}^n(x_i-\overline x)(y_i-\overline y)} {\displaystyle\biggl[\sum_{i=1}^n(x_i-\overline x)^2 \sum_{i=1}^n(y_i-\overline y)^2\biggr]^{1/2}}
\mathrm{corr}(X) = \frac{1}{(2\pi)^{N/2}}
f_X(x_1...x_N) = \frac {1}{(2\pi)^{N/2} {\left| \Sigma \right|} ^{1/2}} \exp \left(-\frac{1}{2}(x -\mu)^t \Sigma^{-1} (x-\mu) \right)
f_X(x_1...x_N) = \frac {1}{(2\pi)^{N/2} {\left| \Sigma \right|} ^{1/2}} \exp \left(-\frac{1}{2}(x -\mu)^t \Sigma^{-1} (x-\mu) \right)
Experimenting with eqnarray: \begin{eqnarray} f & = & g \\ & = & h + i \\ & & +j \end{eqnarray}
Inline equations, does it get the vertical spacing correct?Here is x some x^2 text x^i_j and x^{h^3}_{e_f} some |x\rangle more. \frac{x}{y}
Problems (9 Aug 07)
Tiny little detailThanksEverything works fine now. See http://www.ecse.rpi.edu/Homepages/wrf/pmwiki/Main/jsMath(approve links) ?All working apart from one little glitch... when I load up this page I can see the "sum" and "integral" symbols nice and large with the "i=0" underneath and the "n" on top. Yet in another tab on my offline instance of PmWiki, I still get small versions of all the LaTeX here, with the "i=0" and "n" as large subscript items... judging from the code above, it seems to be to do with the $$ not working! Any suggestions please?! promsan |