This is an old revision of the document!
Table of Contents
mathpublish Plugin
Compatible with DokuWiki
rincewind, angua, Adora Belle
This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.
Similar to asciimath, asciimathml, jsmath, masciimath, math, mathjax, mimetex
This plugin is based on phpmathpublisher by Pascal Brachet to allow inclusion of properly rendered mathematical formulae in DokuWiki pages.
This plugin was originally written by Christopher Smith and named math2.
This is a completely self-contained PHP solution. It requires no third party packages. It makes use of php's GD library and freely available fonts1) to create an images for each formula. The plugin script, phpmathpublisher and the required fonts are all included in the download package.
Installation
Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.
Change Log
- Version upped (2023-01-02 23:50)
- Adjust alignement and rendering issues (2023-01-02 15:34)
- Version upped (2022-07-04 23:50)
- do not use curly brace string access. fixes #16 (2022-07-04 18:47)
- Version upped (2019-03-05 23:51)
- Update deleted.files (2019-03-05 16:05)
- Merge pull request #4 from araname/patch-1 (2016-09-02 21:08)
- Merge branch 'pr/6' (2016-09-02 21:08)
PHP Requirements
To run this plugin your PHP installation needs to have:
- tokenizer library
- gd library
- png capabilities, i.e. libpng, which also requires the zlib library
- freetype font library
Most default installs of PHP (eg. at web hosts) do have all these requirements fulfilled anyway. For full details refer to the PHP documentation.
Examples/Usage
Example:
<m>S(f)(t)=a_{0}+sum{n=1}{+infty}{a_{n} cos(n omega t)+b_{n} sin(n omega t)}</m> <m 8>delim{lbrace}{matrix{3}{1}{{3x-5y+z=0} {sqrt{2}x-7y+8z=0} {x-8y+9z=0}}}{ }</m> <m 32>delim{|}{{1/N} sum{n=1}{N}{gamma(u_n)} - 1/{2 pi} int{0}{2 pi}{gamma(t) dt}}{|} <= epsilon/3</m>
Result2):
Syntax
The general syntax to embed a formulae is this:
<m size>...mathematical formulae...</m>
- size (optional) the base glyph size in pixels - default value: 12.
- alignment can be controlled in the same way as DokuWiki images, one space to the left to right align, one to the right to left align, one on each side to centre.
For a complete list of what mathematical terms can be used, refer to the original mathpublisher documentation or this DokuWiki-compatible formulae syntax page3)
Cyrillic support
Modification of expression.php for cyrillic support:
- expression.php.diff
162,185c162,250 < 'tanh' => 'tanh' < ); < < /** < * Symbol to font assignment < */ --- > 'tanh' => 'tanh', > //cyrillic > 'А' => 'А', > 'а' => 'а', > 'Б' => 'Б', > 'б' => 'б', > 'В' => 'В', > 'в' => 'в', > 'Г' => 'Г', > 'г' => 'г', > 'Д' => 'Д', > 'д' => 'д', > 'Е' => 'Е', > 'е' => 'е', > 'Ж' => 'Ж', > 'ж' => 'ж', > 'З' => 'З', > 'з' => 'з', > 'И' => 'И', > 'и' => 'и', > 'Й' => 'Й', > 'й' => 'й', > 'К' => 'К', > 'к' => 'к', > 'Л' => 'Л', > 'л' => 'л', > 'М' => 'М', > 'м' => 'м', > 'Н' => 'Н', > 'н' => 'н', > 'О' => 'О', > 'о' => 'о', > 'П' => 'П', > 'п' => 'п', > 'Р' => 'Р', > 'р' => 'р', > 'С' => 'С', > 'с' => 'с', > 'Т' => 'Т', > 'т' => 'т', > 'У' => 'У', > 'у' => 'у', > 'Ф' => 'Ф', > 'ф' => 'ф', > 'Х' => 'Х', > 'х' => 'х', > 'Ц' => 'Ц', > 'ц' => 'ц', > 'Ч' => 'Ч', > 'ч' => 'ч', > 'Ш' => 'Ш', > 'ш' => 'ш', > 'Щ' => 'Щ', > 'щ' => 'щ', > 'Ъ' => 'Ъ', > 'ъ' => 'ъ', > 'Ы' => 'Ы', > 'ы' => 'ы', > 'Ь' => 'Ь', > 'ь' => 'ь', > 'Э' => 'Э', > 'э' => 'э', > 'Ю' => 'Ю', > 'ю' => 'ю', > 'Я' => 'Я', > 'я' => 'я' > ); > > /** > * Symbol to font assignment > */
Discussion
How about replacing the - with − (the − sign) by adding in expression.php
to protected $symboles = array(
something like '-' ⇒ '−',
? I don't know if this should go upstream …
Hi, I From Perú, the plug in work awessome but i need to change the color of the formula to white, the background color of my template es black and look very bad, It's possible something to fix this? Thanks!
Excellent Plugin!!! I especially like the self contained nature and the fact the formulas will export in the pdf export as well!! Thanks and well done. Blake