|
Whenever entering maths markup in a page you are editing, you have to enter the maths environment . You do this in the same way you enter any environment - surround it with the name of the wiki markup. So enter {math} ... some mathematical equations ... {math}. There are two types of syntax you can use to type your mathematical expressions - a 'calculator-like' syntax allows you to specify things as you might on a calculator - e.g 'x/(y+1)' or 'x^4+y^5'. For those wishing more control, a TeX-like syntax can also be used. This means that you should be able to copy and past equations from LaTeX examples should you have the .tex file. You can mix and match the calculator-like and TeX-like syntaxes.
You can also find guides at http://www.wjagray.co.uk/maths/ASCIIMathTutorial.html and http://www1.chapman.edu/~jipsen/mathml/asciimathsyntax.html. Alternatively, search google for ASCIIMath (possibly with the word tutorial) and see what comes up.
The Math (ASCIIMath) Plugin is compatible with Confluence v2.8+. An option is available for older installations of Confluence: ASCIIMath plugin for older versions of Confluence.
Examples
Instead of giving a large tutorial, lots of examples are given. Sometimes, certain points are made clear but hopefully you should get the gist of how ASCIIMath works just by seeing it in action (see image top right). Note that it is necessary to show the examples as images instead of actual MathML renderings because the ASCIIMath plugin itself is not installed on this particular instance of Confluence. The images used are real screen captures from Firefox 3.0x using Confluence with ASCIIMath installed. There is also a handy
guide
Display Options
Normally when you use {math} markup the mathematical expressions inside will be displayed inline - that is it will be merged in with the surrounding paragraph text. You can put {math} in lists, in tables, in headings, can color them, etc - just as you'd expect. Sometimes you may wish to emphasize a particular piece of mathematics and/or label it so you can refer back to it.
'Block' {math}
To make a mathematical expression interrupt the flow of a paragraph and 'stand out' you can add display=block to the starting {math} markup like so:
{math:display=block}d/dxf(x)=lim_(h->0)(f(x+h)-f(x))/h{math}
produces:

Labels
You can also add labels to your creations - Just add label=whatever. Normally you might use labels when displaying in a 'block' but this does not need to be the case - so
{math:label=1.1}sqrt(x-y^2){math}
looks like
and
{math:display=block|label=1.2}d/dxf(x) =lim_(h->0)(f(x+h)-f(x))/h{math}
looks like:

The labels appear on the far right in line with the expression. The text of the label can be anything you want.
List of Symbols
Here are all the symbols you can use and their markup. It should be pointed out that they are pretty much identical to the LaTeX markup except that latex markup are always preceeded with a \ (backslash).
Troubleshooting
This section may be useful if you are having problems authoring or displaying the mathematics.
Browser Recommendations and Compatibility
ASCIIMath uses a technology called MathML to display the the maths. We recommend Firefox 1.5+ or Internet Explorer 6.0+ with MathPlayer installed for viewing. Other browsers (e.g Safari, Opera) or Internet Explorer without MathPlayer will display the mathematics as images as a fallback.
Authoring Issues
- The Rich Text editor can sometimes break existing {math} markup in your page. We strongly recommend that you use the Wiki Markup method of editing wiki pages with {math} tags.
- ASCIIMath tries to guess what you mean in a lot of cases. If you are finding that the output looks wrong then try wrapping sub-expressions in parenthesis to help clarify meaning.
- Be sure to escape $ or ` (backquote) symbols inside your {math} markup - as these are used by ASCIIMath itself. To escape $ and `, use \ (backslash) in front like so: \` and \$
Printing and Export Issues
There may be printing and/or export issues depending on the browser you are using.
All browsers: Printing
The JavaScript required to render as MathML or images is not included in the popup printing preview page. This means the {math} wiki markup will not render correctly - you will see the markup content surrounded by backquotes instead.
Soln: Can this be fixed?
MathML-rendering browsers only: Export as PDF or Word
Unfortunately, the technologies used by Confluence to convert HTML to PDF and Word do not know how to deal with the MathML present on the page. This is the case for Firefox/Mozilla and IE (6.0+) with MathPlayer. The result will be the original {math} markup shown as text.
Soln: View the page in a browser that displays the {math} markup as images - e.g Safari or Opera or IE without MathPlayer.
Technical Issues
- Firefox 1.5+: MathML uses fonts which sometimes may not be available on the computer you are using. Firefox will show a warning dialog box if it cannot find the fonts it needs to show the mathematics. If you find yourself shown this warning dialog by Firefox then you can download and install the required fonts by following instructions at http://www.mozilla.org/projects/mathml/fonts/.
- Internet Explorer requires Design Science's free MathPlayer plugin to display MathML. If you do not have the MathPlayer plugin then you can download and install it from the MathPlayer website.
Version History
| ? | Enable print/pdf support |
|---|---|
| 1.2.1 | Includes a range of anti XSS measures by default, that can be disabled via plugin config page. |
| 1.1.2 | Enables administrators to configure 'download' text message, as well as improving ability to block IE6 from using external CGI, if configured to do so |
| 1.1.1 | Enables administrators to configure whether IE users should be allowed to fall-back to externally hosted CGI rendering of Math Markup, or be prompted for the installation of the Math Player plugin CASCII-1 |
| 1.1.0 | Plugin released in repository, automatic download of dependant .css and .js files |


Comments (20)
Mar 21, 2009
Mike Cannon-Brookes says:
Mate - thanks for the plugin, it's awesome!! mMate - thanks for the plugin, it's awesome!! m
Mar 25, 2009
Brian Carr says:
I was able to manually install the plugin using the these instructions. But when...I was able to manually install the plugin using the these instructions. But when I tried to use the Plugin Repository, I received the following error saying that the jar was not found:
Mar 25, 2009
Andy Brook says:
Gah. Forgot to commit! 1.1.2 is in the repo now, and should resolve in a little...Gah. Forgot to commit! 1.1.2 is in the repo now, and should resolve in a little while (I think, will check later), appologies.
Mar 27, 2009
Kevin Beatty says:
Hello there. Great Plug-in. Is there any chance of adding encoding / deco...Hello there. Great Plug-in.
Is there any chance of adding encoding / decoding to the passed mathematical equation? It involves running an encode method on the String before it is passed and a decode method on the other side. Basically, one liners added to the source. The supporting Java classes are already written. Just need to call them.
http://java.sun.com/j2se/1.5.0/docs/api/java/net/URLEncoder.html
http://java.sun.com/j2se/1.5.0/docs/api/java/net/URLDecoder.html
I am forbidden to use this plug-in because it is vulnerable to cross-site scripting attacks. Anything that uses passes special characters like (< > " ' % ; ) ( & + -), unencoded, is vulnerable. Obviously, those are pretty common for math
For anyone unfamiliar with the joys of cross-site scripting attacks, here is a quote and a few links to enjoy.
"As of 2007, cross-site scripting carried out on websites were roughly 80% of all documented security vulnerabilities"
http://en.wikipedia.org/wiki/Cross-site_scripting#Exploit_scenarios
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q252985
The nice thing about change is that it won't change functionality. Just makes it more secure so that cookies, credentials, commands, can't be hijacked. Based on the code I saw, this wouldn't be too hard for the original programmers to do. They obviously know what they are doing. Again, the plug-in is great.
Just wondering ..
Mar 27, 2009
Andy Brook says:
heh, OK, would say this is a 'bug'. Yea, know about URLcoding, just didn't cros...heh, OK, would say this is a 'bug'. Yea, know about URLcoding, just didn't cross my mind at the time. Probably get this fixed next week.
Mar 27, 2009
Kevin Beatty says:
Wow! Thanks, Andy.Wow! Thanks, Andy.
Mar 30, 2009
Andy Brook says:
With retrospect, URLEncoding the content might not be viable, IIUC the value sav...With retrospect, URLEncoding the content might not be viable, IIUC the value saved from the web page is interpreted by other javascript, converting to mathml, which in turn is rendered directly by Firefox/ MathPlayer. Encoding the content going down would break that, unless some 'just-in-time' urldecoding was done in javascript. Its possible HMTL Entity conversion would work, but it could equally break the renderer as its not the 'browser' thats interpreting the characters. Had a quick look for html entity conversion java /javascript libraries, its not a straight forward change. On the queue though...
Mar 30, 2009
Kevin Beatty says:
Hmmm ... I'm not a security expert but I play one on TV. So I ...Hmmm ... I'm not a security expert but I play one on TV. So I just did some reading on the XSS vulnerability.
Is it possible that the plug-in is NOT vulnerable to XSS, even though it sets off our security test alarms? From what I have read, XSS is all about something executing embedded, malicious javascript, typically embedded in a link. For confluence, I believe it would done by embedding malicious code within the <math> macro itself and then getting users to go to that page. Is there another way?
Assume I am correct, if the macro takes the web page value from the client and other Javascript converts it, validates it, converts it to MathML, and finally sends MathML to the browser I don't see how the attack happens. MathML is being processed by the browser, not unencoded stuff. Again, not a security expert, but I still have to debate with them. Do you have a better feel for if this a real security risk?
Mar 30, 2009
Andy Brook says:
Hi Kevin, yes thats about it. Content is downloaded, maniuplated by Javascript ...Hi Kevin, yes thats about it. Content is downloaded, maniuplated by Javascript into mathML then processed other by other code (firefox-mathml renderer / plugin), rather than being interpreted by the browser as Script/HTML. I'm certainly no security expert, but I get the feeling this is a low threat, in terms of XSS.
Apr 10, 2009
Kevin Beatty says:
Hey Andy: Our security team demonstrated the vulnerability to me. At leas...Hey Andy:
Our security team demonstrated the vulnerability to me. At least one flavor of it. I found it very surprising. I do not want to post it. If you are interested, please contact me directly: kevin.n.beatty@seagate.com and I will send it to you.
Apr 17, 2009
Hicham Mouline says:
If I understand the difference between using MathML and not using MathML 1. Math...If I understand the difference between using MathML and not using MathML
1. MathML : the httpd sends to the browser xml that is MathML and the browser renders this
2. without MathML: the httpd generates the rendering on the server box and sends the resulting image to the browser which displays it
correct?
sadly, I use mostly g chrome and it doesn't support MathML.
Apr 17, 2009
Keith Brunton says:
Hi Hicham, ASCIIMath detects whether your browser is capable of rendering Math...Hi Hicham,
ASCIIMath detects whether your browser is capable of rendering MathML - i.e it is either Firefox (gecko family) or IE with MathPlayer installed. If a non-MathML-capable browser is found (IE without MathPlayer, Safari, Opera, Chrome) then ASCIIMath uses the 'Image Fallback' option. Basically <img> tags are inserted have hrefs that point to a MathTeX service which takes latex markup passed as a param and generates the corresponding image. By default, ASCIIMath uses the MathTex author's service at http://www.forkosh.dreamhost.com/mathtex.cgi but it is possible (recommended even) to install the MathTex service locally and use that instead. Unfortunately it is currently not possible to configure the location of the MathTex service for the ASCIIMath Plugin through the Confluence Plugins Configuration Panel.
Apr 20, 2009
Andy Brook says:
Now back at work I have a windows VM, FYI I just tried Chrome and sure enough it...Now back at work I have a windows VM, FYI I just tried Chrome and sure enough it doens't work out of the box, (image fallback), the script fires but doesn't 'fallback'. Keith can you figure out that script, gives me a headache looking at it! I can detect chrome but cannot seem to figure out how to provoke fallback behavior.
var _isChrome= navigator.userAgent.toLowerCase().indexOf('chrome') > -1;Apr 20, 2009
Andy Brook says:
v1.2 just released, includes anti XSS measures, which are on by default. If pro...v1.2 just released, includes anti XSS measures, which are on by default. If problems are encountered just disable and comment here...
May 04, 2009
Kevin Beatty says:
Anti-XSS has passed our security tests. Nice job! Thanks.Anti-XSS has passed our security tests. Nice job! Thanks.
Jul 09, 2009
Michael Gettes says:
Do the Anti-XSS measures mean it is now safe to use this for IE without the plug...Do the Anti-XSS measures mean it is now safe to use this for IE without the plugin?
Jul 09, 2009
Andy Brook says:
I would have though using IE at all makes it unsafe It's as safe as could be r...I would have though using IE at all makes it unsafe
It's as safe as could be reasonably be expected. It's possible the measures could be circumvented by an incredibly determined XSS attacker, but I think is does a fine job of cutting out a wide range of possibilities.
As usual, do your own due diligence, don't sue me, I'm not even here
Sep 12
Michael Gettes says:
The MathML plugin for IE seems to be broken for IE7/8. I have disabled the...The MathML plugin for IE seems to be broken for IE7/8. I have disabled the IE check in the asciimath.vm file and now the plugin no longer gets called and an image is displayed like Opera and Safari. Seems to work fine. As it would appear the MathML plugin is not being updated - maybe this should be a permanent fix?
Oct 27
Andy Brook says:
This plugin just wraps the work of others - its the wider community that are dev...This plugin just wraps the work of others - its the wider community that are developing it. Happy to include further fixes as/when they become available. Am progressing this being updated for Confluence3. I had thought the IE detection was working, if there is a problem, why not raise a bug
Oct 29
Andy Brook says:
ASCIIMath is now installable for Confluence 3.x from the plugin repository.ASCIIMath is now installable for Confluence 3.x from the plugin repository.