||This extension requires patches to core MediaWiki code. Extensions implemented using patches may be disabled by or interfere with upgrades and security patches. If a suitable alternative without a patch is available, we recommend you use that extension instead.|
Release status: stable
|Description||Adds a tag that outputs math expressions in ASCIIMath as MathML.|
|Author(s)||Ariston Martins Cordeiro|
|Latest version||1.0 (2006-06-12)|
|License||No license specified|
Translate the ASCIIMath4Wiki extension if it is available at translatewiki.net
|Check usage and version matrix; code metrics|
This extension adds a
<asciimath> tag that outputs math expressions written in ASCIIMathML as MathML.
It is a lighter alternative to LaTeX for mathematical expressions, which has higher demands in terms of storage space, process, Linux package installations, et cetera. This extension doesn't create image files, nor require any 3rd party server-side packages, but relies on the client's browser's support for rendering MathML. ASCIIMathML's syntax is also easier and more human-legible than LaTeX's.
Usage[edit | edit source]
Syntax[edit | edit source]
Math expressions can be written in ASCIIMathML syntax, contained by the custom
Browser compatibility[edit | edit source]
MathML is a World Wide Web Consortium standard, but not all browsers support it properly.
- Internet Explorer doesn't support MathML at all; Internet Explorer users can view MathML with the Math Player plugin.
Installation[edit | edit source]
The extension requires MediaWiki 1.6+ and the ASCIIMathPHP 1.1+ PHP extension, and the skin files must be modified to support MathML. Also, avoid using this extension with TeX; If you're using TeX, try to use that for math instead.
- Download the extension (includes ASCIIMath4Wiki and ASCIIMathPHP).
- Unpack the files to /extensions/ in the root of your MediaWiki installation. The package should include ASCIIMath4Wiki.php, ASCIIMathPHP.cfg.php, and ASCIIMathPHP.class.php.
- Add the following line to LocalSettings.php (near the bottom):
- Specify the skins as XML and change their DTDs to support XHTML+MathML (see below).
- Watch out for unclean HTML rendering in wiki extensions.
Changing the skin's DTD[edit | edit source]
Caution: All wiki HTML tags rendered (even the ones parsed from the wiki text) are XHTML compatible, so the MediaWiki alone won't have any problem outputting as XHTML. But watch out for unclean HTML in other wiki extensions. Keep in mind that any tag error in output will generate an XHTML parsing error, "breaking" the page; XHTML is very unforgiving.
MediaWiki skins render pages as HTML. To allow MathML in your skin, you must make it as XHTML+MathML (by rendering it as a XML document and specifying the header about the XHTML and MathML tags). That mean you will have to change the wiki's page rendering to all allowed skins.
Below is an example of how to change MonoBook:
Open /skins/MonoBook.php in your wiki and find these lines; make sure to make the equivalent change in each skin's main file.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">
Change the above to this:
<?php header('Content-type: application/xhtml+xml; ;charset=utf-8'); header('Vary: Accept'); echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [ <!ENTITY mathml "http://www.w3.org/1998/Math/MathML"> ]> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">
Remember you should change it in all allowed skins, not only Monobook.