This plugin hasn’t been tested with the latest 3 major releases of WordPress. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.



Display mathematical equations within your posts and comments.

Put your plain text mathmatical expressions between [pmath size=xx]…[/pmath] tags. The optional size attribute controls how large the images will be displayed. Useful xx integer values range from 8 to 24. Size defaults to 12 when attribute omitted. Pascal Brachet’s PHP Math Publisher library is included.

Watch the youtube demo Introduction to Math Blogging

How To

To toggle to the math mode within your blog’s content, you must use the [pmath size=xx]…[/pmath] markdown tag. The plugin automatically replaces your math text commands into HTML image tags that look sort of like this:
<img src=”MathFileName.png” style=”vertical-align:-xxpx; display: inline-block ;” alt=”your math text command”/>.

The math commands must be separated by a space character or surrounded by {}.


  • [pmath size=12]S(f)(t)=a_{0}+sum{n=1}{+infty}{a_{n} cos(n omega t)+b_{n} sin(n omega t)}[/pmath]
  • [pmath size=24]delim{lbrace}{matrix{3}{1}{{3x-5y+z=0} {sqrt{2}x-7y+8z=0} {x-8y+9z=0}}}{ }[/pmath]
  • [pmath]delim{|}{{1/N} sum{n=1}{N}{gamma(u_n)} – 1/{2 pi} int{0}{2 pi}{gamma(t) dt}}{|} <= epsilon/3[/pmath]

Math elements supported:

  • Usual commands
  • Parenthesis
  • Math space
  • Greek letters
  • Symbols
  • Arrows
  • Sets
  • Roots
  • Limits
  • Big operators
  • Delimiters
  • Matrix
  • Constructions

pmath syntax


  • WordPress post with [pmath] tags mixed with plain text
  • WordPress comments with [pmath] tags mixed with plain text (as shown from WP v:2.5.1 admin tool's detail view)
  • WordPress plugin management page after upload and activation
  • Sample directory structure of this plugin within a WordPress installation
  • status display from the author's blog > Manage > wpmathpub menu


  1. Unzip into your /wp-content/plugins/ directory. If you’re uploading it make sure to upload
    the top-level folder wpmathpub.
  2. Make sure the newly installed ./wpmathpub/phpmathpublisher/img directory is readable and writable on your web server (See FAQ for more details)
  3. Activate the plugin through the usual ‘Plugins’ menu in WordPress


Where can I learn more about wpmathpub’s graphics library?

wpmathpub (aka wp math pub) is based on Pascal Brachet’s phpmathpublisher library.

You can learn more about phpmathpublisher from here: overview

Note: wpmathpub WordPress plugin uses [pmath]your math text[/pmath] to create math graphical equations within posts and comments. While, from Pascal’s demo and test site, you will use <m>your math text</m> to create math equations.

The [pmath] tag doesn’t seem to work. How can I solve this problem?

Starting with version 1.0.7, use the wpmathpub plugin status display menu from your blog’s admin site’s “Manage” or “Tools” menu. See screenshot #5 (in the screenshots tab) for details. The status display will:

  • check your system for correct access to required directories,
  • determine if required libraries are available, and
  • show a sample math conversion from text to image format.
  • Use the results within the table to help troubleshoot installation issues.
Do some plugins interfere with the wpmathpub plugin?

Starting with version 1.0.7, an enhanced priority scheme was implemented to improve reliability and better cooperation with some high bandwidth video streaming plugins.

At this time, only one plugin is known to play havoc with display of math images from within comments called: Live Comment Preview. Blog posts are not affected. This plugin causes the [pmath] start tag to get out of sync with the [/pmath] end tag.

If you suspect plugin interference, a simple test is to disable all of your plugins except wpmathpub. If wpmathpub works without other plugins, start turning on your plugins one by one to see which one(s) are interfering with [pmath] tag filtering. If you find one, let me know – I may be able to find a solution.

During installation how can I make sure the ‘img’ directory has write access?

The ‘img’ directory needs write access to create new math images from your blog’s math text. Starting with version 1.0.5, the wpmathpub plugin automatically assigns the correct access rights to the ‘img’ directory on Linux/Unix installations. This auto-assignment feature can be turned off by changing line 55 in wpmathpub.php to read:

define(“AUTOCHMOD”, false);

Below is a sample bash shell session demonstrating how to manually locate the ‘img’ directory, change its mode to include write access, and verify the change was made:

-bash-3.00$ cd wp-content

-bash-3.00$ cd plugins

-bash-3.00$ cd wpmathpub

-bash-3.00$ cd phpmathpublisher

-bash-3.00$ chmod 755 img

-bash-3.00$ stat -c %a img


-bash-3.00$ stat -c %A img


How can I disable the use of [pmath] tags within blog comments?

By default, the wpmathpub plugin supports user generated math equations in comments. Starting with wpmathpub plugin version 1.0.6, you can disable the use of [pmath] tags in comments by changing line 58 in wpmathpub.php to read:

define(“ENGAGECOMMENTS”, false);

This setting will not affect the display of math equations in blog posts and pages.

Can I use HTML entities like “& gt;” (for “>”) in my math text equations?

Starting with wpmathpub version 1.0.5 HTML entities are supported.

Can I use pmath tags in blog posts AND blog comments?

Starting with wpmathpub version 1.0.5 both blog posts and comments support pmath tags.

I have a new Q

You may go to the WordPress wpmathpub support page to ask questions:
WordPress wpmathpub Support Page


November 23, 2018
it gives me error: Fatal error: Uncaught Error: Call to undefined function ereg() in ....web/wp-content/plugins/wpmathpub/phpmathpublisher/mathpublisher.php:1604 Stack trace: #0 /nfsmnt/hosting1_1/4/c/4cdba5d2-b725-4d56-95e7-7244c2ed5f96/ detectimg('629fdc23df6a73c...') #1 /nfsmnt/hosting1_1/4/c/4cdba5d2-b725-4d56-95e7-7244c2ed5f96/ mathimage('S(f)(t)=a_{0}+s...', '12', 'http://dveadves...') #2 /nfsmnt/hosting1_1/4/c/4cdba5d2-b725-4d56-95e7-7244c2ed5f96/ mathfilter('<m>S(f)(t)=a_{0...', '12', 'http://dveadves...') #3 [internal function]: wpmathfilter(Array) #4 /nfsmnt/hosting1_1/4/c/4cdba5d2-b725-4d56-95e7-7244c2ed5f96/ preg_replace_callback('#\\[pma in /nfsmnt/hosting1_1/4/c/4cdba5d2-b725-4d56-95e7-7244c2ed5f96/ on line 1604
September 3, 2016
Very useful to use. Thank you for this plugin.
September 3, 2016
The advantage of this plugin to other ones is that it doesn't use "\" (backslash) which other latex-based plugins do. Backslashes are sometimes stripped in WP leading to formulas not showing properly.
Read all 5 reviews

Contributors & Developers

“wpmathpub” is open source software. The following people have contributed to this plugin.


Translate “wpmathpub” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.



  • Update phpmathpublisher code for fatal errors and test plugin on PHP 7


  • Update wpmathpub code for PHP 7


  • Improved documentation


  • Improved documentation


  • Improved documentation


  • Fixed a few bugs, improved documentation.