Summary: Add markup to display and embed mathematical formulas in wiki pages using TeX.
Version: 2007-02-14
Prerequisites: pmwiki-2.0.0
Status: Stable
Questions answered by this recipe
Notice that you can double click on images to see the LaTeX code.
- Can I get mathematical formulas to change size as the text changes size? (Yes. You can either install the TeX fonts, adjust the options in the jsMath control panel, or reload your page once you get to the desired size, and the images will download correctly.)
- Is there a way to print crisp clean mathematics directly from the webpage?
Description
Embed scalable mathematics in webpages with high print quality.
Notes
You can download jsMath from the author's website at http://www.math.union.edu/locate/jsMath. It is a javascript method of embedding mathematics into webpages. Users can either view mathematics output using precompiled images on the server, or users can download and install TeX fonts on their computer which speed up the view experience and increase the quality printing.
- Download jsMath.phpΔ and put it in the
cookbook/ directory
- Download and install the latest jsMath archive from Sourceforge into your PmWiki's
pub/ directory, as pub/jsMath/ . Or, you can install jsMath wherever you wish, and edit config.php to set $JsMathUrl to the url of the jsMath directory.
- Download and install the appropriate fonts from the author's website here
- Add the following line to a local customization file:
include_once('cookbook/jsMath.php');
That's it! The script adds {$$ ... $$} and {$...$} markups that
display LaTeX-style math equations, the first form centers the
equation, while the second generates the equation "inline".
- You will find your experience to be better if you actually download
and install the jsMath fonts, but the site can be viewed just the
same without.
- The math graphic for the GUI toolbar is available at
.
Using jsMath without ~80 MB of fonts
You can force jsMath to work without with font files. This only works if users are willing to download the font files to their computers. I modified the jsmath.php file as follows (not sure if some of this is redundant):
$HTMLHeaderFmt['jsMath'] = '
<script> jsMath = {Controls: {cookie: {scale: 120}}} </script>
<script src="$JSMathUrl/plugins/noImageFonts.js"></script>
<script src="$JSMathUrl/plugins/autoload.js"></script>
';
$HTMLFooterFmt['jsMath'] = '
<script src="$JSMathUrl/plugins/noImageFonts.js"></script>
<script>
jsMath.Autoload.Check();
jsMath.Process(document);
</script>
';
Release Notes
Comments
See Discussion at JsMath-Talk
Disable message "No jsMath TeX fonts found"
I'm not sure what the newest developments of this recipe are, but I didn't care about font quality as long as one could read the formula on the screen. So I simply disabled the red message box above by adding the following line to config.php before (!) the include_once statement of this recipe (my reference):
$HTMLStylesFmt[] = "#jsMath_Warning {display: none}";
Frank, 14-Dec-2008
See Also
- Cookbook /
-
-
- ASCIIMath Display MathML rendered ascii formula into PmWiki 2.x pages (Stable)
-
- Formula Lightweight rendering of mathematical formulas in wiki pages (Beta)
-
- LaTeXMathML Translating LaTeX math notation dynamically to Presentation MathML (Stable)
-
- LinuxTex Enable TeX markup
-
- MathJax Add markup to embed math using TeX syntax. (Stable)
-
- Mathtex Add markup to display and embed several lines of mathematical formulas in wiki pages (testing)
-
- MimeTeX Add markup to display and embed mathematical formulas in wiki pages (Stable)
-
- SimpleJsMath
-
- TrueLatex Enables interpretation and rendering of real LaTeX markups in PmWiki. Support for XeLaTex included in v1.8. (Working perfectly. Very simple to use, customizable and comes with lots of options.)
Contributors
Ben Woodruff
User notes +3: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.