# MathPublisher plugin for Joomla

The MathPublisher plugin for Joomla 1.5 and 1.6 allows you to easily add maths to your pages.

The plugin uses phpMathPublisher by Pascal Brachet from http://www.xm1math.net/phpmathpublisher/ where you can find help on the syntax, try it out and see some examples. phpMathsPublisher is also used by plugins for DokuWiki and WordPress

The phpMathPublisher syntax is probably slightly easier to use than TeX that is used by other plugins e.g. MimeTeX and arguably produces better looking output.

Note. MathPublisher is getting a bit old now. I suggest you check out MathJax.

If you are interested in alternatives to MathPublisher there is a good review by Alex Matulich.

Version 1.8 (released 2011-02-04) with simpler configuration. Works with Joomla 1.6 and 1.5.

### Installation

Go to the plugin manager to configure and enable the plugin.

### Configuration

Go to Extensions > Plugin Manager and click on Content - MathPublisher. Enable the plugin and check the configuration.

The default installation assumes joomla is at your root server url e.g. http://my.server.org/*. You may need to change the joomla_url_root setting to match your site configuration.

You can use an alternative key instead of the rather lengthy {mathpublisher} and the default is {math}. Don't be tempted to use a single character (e.g. m as the string {m} is very likely to apper in formulae and will confuse the plugin.

Font and background colour may also be specified to match your website sytle.

 name example default description alternativetag formula math Alternative tag to trigger the plugin usage. If you think that {mathpublisher} is too long and prefer shorter syntax, feel free to specify your own tag. For example: math (avoid very short tags e.g. m - consider sum{m}{n}{p}) joomla_root (not needed from v1.8) cms/joomla joomla This is where joomla is installed. This is the relative path under DOCUMENT_ROOT to joomla e.g. libraries/joomla (use a single / if joomla is installed directly in your DOCUMENT_ROOT) joomla_abs_root (not needed from v1.8) /usr/pathto/htdocs Optional alternative absolute path to joomla. Some free hosts do not set DOCUMENT_ROOT to each users path, so the relative joomla_root will not work. Specify the full path to joomla here if you need to. Otherwise, leave blank joomla_url_root content joomla This is where joomla is accessed from your sites root URL. E.g. joomla for http://my.site/joomla/. If joomla is accessed in the root of your web site, use a single / here. color #ff8844 #000000 Font color. The color for the formula. Use html #rrggbb style e.g. #ff8844 or #f84. bg_color #002030 #ffffff Background color. The background color - used for anti-aliasing which makes the characters look smoother. Choose a value that is close to the average background color behind the formula. Use html #rrggbb style e.g. #002030 or #023. enable_in_comments Yes No Enable in comments. Select Yes to allow math to be used in comments. Tested with JComments only.

The default config is usually OK for most hosting providers, but if not, and you are unsure what values to use, the following may help:

If Joomla is not accessed from your sites root url, you will need to set "This is where joomla is accessed from your sites root URL." otherwise the formula images will not show.
You can get this value from the Joomla administration URL. It is the path between the host name  and /administrator/index.php

http://www.mywebsite.com/some/path/administrator/index.php

Use "some/path"

If Joomla is accessed directly in the root of your site, the admin URL will be something like:

http://www.mywebsite.com/administrator/index.php

Leave empty or use a single slash "/". On versions earlier than 1.8 use a single slash "/" (do not leave empty, as that will use the default "joomla")

Versions earlier than 1.8 also may need you to set either "This is where joomla is installed" or "Optional alternative absolute path to joomla". If you have difficulty setting this, try the following:

Open the System tab and copy the value of "Path to Log folder"

This contains the full path to your joomla installation with '/logs' on the end. So you can remove the '/logs' and use the remaining path for the value of "Optional. Alternative absolute path to joomla".

#### Use in comments and forums

The MathPublisher tags will work in Kunena forum posts if you set "Joomla Mambot Support" to "Yes" in the Kunena front end configuration.

JComments will show maths if you set "Enable in comments" to yes in the MathPublisher configuration. This setting may also work for other comment plugins, but I have only tested it with JComments.

### Usage

{mathpublisher size=16} pi approx 22/7 {/mathpublisher}

shows:

{mathpublisher} pi = 22/7 - int{0}{1}{ { x^4 (1-x)^4} / {1+x^2} dx }  {/mathpublisher}

The optional size= parameter specifies the font size and defaults to 14. any value between 10 and 26 may be used. values will be restricted to this range.

It is OK to place maths within other text, for example: the radius of a circle is and its circumference is .

If you need to override the default colour, you may also include color= and/or bg_color= parameters in the tag. These colour tags only support the html #rrggbb or #rgb style colours which should not be quoted. The bg_color is only used to anti-alias the formula so that it looks good against your site background, so choose a setting that is close to the typical background colour of your site. The main background of the formula image will be transparent so that your site background shows through.

Examples:

{math color=#fff bg_color=#000} ...

{math color=#000 bg_color=#008000} ...

{math color=#ffff00 bg_color=#800000} ...

### Comparison with MimeTeX

 MathPublisher MimeTeX {math}pi = sum{n=0}{+infty}{ {(n!)^2 2^{n+1}} / {(2n+1)!} }{/math} {tex}\pi=\sum\limits_{n=0}^{+\infty} \frac{{(n!)^2 2^{n+1}}}{(2n+1)!}{/tex} $\pi=\sum\limits_{n=0}^{+\infty} \frac{{(n!)^2 2^{n+1}}}{(2n+1)!}$

### Version History

2011-02-01 version 1.8 simpler configuration and some debug info when it fails.  download v1.8
2010-06-02 version 1.5 improved support for special characters. Minor bug fixes. download v1.5
2010-02-09 version 1.1 includes colour support and ability to specify an absolute path to joomla. A few minor bug fixes. download v1.1
2010-01-22 version 1.0 original version. Black formulae with best results on light backgrounds. download v1.0

Posted by Ian on
Hi Zeoo,
Unfortunately, mathpulisher does not work with several other Joomla extensions, including ARI QUIZ because iof the way those extensions are written.

You may be able to use something like MathJax (http://www.mathjax.org/) which is javascript based.

Ian
Posted by Marc on
Great plugin. I love the colour support.

There are just two annoying problems I have when using this plugin with my website (Joomla 1.7):
- The symbol | is not properly shown, but is shown as a large -; so, P(X|x) shows up as P(X-x).
- Sometimes the Joomla editor (both TinyMCE and HTML) automatically removes some parts of the formulae (and some of the text surrounding it).
Any idea why this happens, and how this can be solved?

Regards
Marc
Posted by Ian on
Hi Marc,
This plugin is based on phpmathpublisher which has rather limited support for special characters. My only suggestion is to use vert e.g. P(X vert x) or P(X{vert}x) but this will be a double vertical bar, not a single one. A vertical bar may be used as a delimiter delim{|} x {|} but you must have them in pairs.

The TinyMCE problem is probably due to special characters being "cleaned" up. This is an annoying feature of the Joomla (and many other) editor plugins. You may be able to get around it by using some of the special symbol codes listed here http://www.xm1math.net/phpmathpublisher/doc/help.html

If I get some time, I may look into a fix to render | properly, but this code is pretty old now and you may be better moving to something like mathjax. I've not used this myself yet, but it looks good and supports colour via css. They seem to have some help for Joomla users.

Ian
Posted by Onitsuka Tiger on
Attractive section of content. I just stumbled upon your website and in accession capital to assert that I acquire in fact enjoyed account your blog posts. Any way I will be subscribing to your feeds and even I achievement you access consistently fast.
Posted by home Security on
I found your blog when I was looking for a different sort of information but I was very happy and glad to read through your blog. The information available here is great.
Posted by charit on
The MathPublisher plugin for Joomla 2.5 please
Posted by Jacques Charpié on
I found a practical and simple way to put good quality equations in joomla 2.5:
use mathtype (6.7), edit an equation, cut and paste your equation into a normal joomla article et voilà!
I use the joomla JCE editor.

You first have to set the cut and paste preference of mathtype to "JoomlaLMS", but you don't need the joomlaLMS component

Check a test output at: http://www.didacti.ch/index.php/mathematics
Posted by SEO Expert on
I love this type of informative blog very much.SEO Expert
SEO Consultant
SEO Expert Pakistan
Cheap SEO Services
Posted by logo design company reviews on
This post is informative for me and all other readers.
logo designer reviews