PhpMathPublisher - math formulas in HTML
In one of the projects, it became necessary to use complex mathematical formulas in the text. The option of using formula editors like Microsoft Equation and then saving it as a picture is not suitable, since the ability to easily edit existing formulas is necessary.
The solution was found in the form of PhpMathPublisher .
PhpMathPublisher is a system for publishing mathematical formulas in HTML using only PHP tools.
Each formula is converted into a PNG image by a script that returns the corresponding HTML code.
The solution is cross-browser, the end user does not need to install any add-ons or fonts.
For the script to work, you need the GD library and some fonts containing mathematical symbols (the fonts are included).
Here are some examples of formulas generated using PhpMathPublisher :
1. Download the archive
2. Unpack the archive. The archive already contains all the necessary fonts, as well as examples and documentation.
To use mathematical expressions, we connect only one file:
... and derive the formulas:
where:
... (more details below);
Parser converts expressions contained in tags on the fly... , in pictures with formulas and saves them in a directory for images. Expression syntax is available in the documentation in the archive or online .
Example:
Converted version:
There are PhpMathPublisher plugins for Wordpress:
http://wordpress.org/extend/plugins/wpmathpub/
http://wordpress.org/extend/plugins/wpmathpublisher/
First post on the hub, please do not judge strictly :)
The solution was found in the form of PhpMathPublisher .
PhpMathPublisher is a system for publishing mathematical formulas in HTML using only PHP tools.
Each formula is converted into a PNG image by a script that returns the corresponding HTML code.
The solution is cross-browser, the end user does not need to install any add-ons or fonts.
For the script to work, you need the GD library and some fonts containing mathematical symbols (the fonts are included).
Here are some examples of formulas generated using PhpMathPublisher :
Using
1. Download the archive
2. Unpack the archive. The archive already contains all the necessary fonts, as well as examples and documentation.
To use mathematical expressions, we connect only one file:
include("mathpublisher.php");
* This source code was highlighted with Source Code Highlighter.
... and derive the formulas:
echo mathfilter($text,$size,$pathtoimg);
* This source code was highlighted with Source Code Highlighter.
where:
$text
- text with standard HTML tags and mathematical expressions enclosed in tags$size
- font size; $pathtoimg
- relative path to the directory for storing images. Parser converts expressions contained in tags on the fly
Example:
pi=3/4 sqrt{3}+24 int{0}{1/4}{sqrt{x-x^2}dx}
* This source code was highlighted with Source Code Highlighter.
Converted version:
There are PhpMathPublisher plugins for Wordpress:
http://wordpress.org/extend/plugins/wpmathpub/
http://wordpress.org/extend/plugins/wpmathpublisher/
First post on the hub, please do not judge strictly :)