Do you want to write math equations in WordPress?
Writing math equations in WordPress is a bit difficult as the default WordPress editor does not come with full support for mathematical equations.
In this article, we will show you how to easily write math equations in WordPress using 3 different methods.
Why Is Writing Math Equations in WordPress Difficult?
The way WordPress works is that it dynamically generates your website content and sends HTML output back to the users’ browsers to display it.
Writing mathematical and scientific equations in WordPress is difficult due to the lack of support for the characters in HTML.
Currently, MathML and LaTeX are considered to be the standard for writing mathematical and scientific equations on the web.
Unfortunately, they are both less than ideal for beginners. They both require you to learn their own syntax, which could get complicated for longer and more complex equations.
That being said, let’s take a look at how to write math equations on your WordPress blog.
We will start off with an easy solution first before showing how to use MathML or LaTeX in WordPress. You can use the quick links below to jump to the method you want to use:
Method 1: Writing Math Equations in WordPress Using Unicode Characters
This method is simpler and is recommended for users who don’t need to write math equations frequently. For this method, we will be using Unicode characters and inserting them directly in the post editor.
Unicode is the encoding standard with the aim to provide character encoding support for all languages. It is supported by all website builders, operating systems, and mobile devices.
Here is how to add mathematical characters in WordPress using Unicode.
1. Adding Unicode Mathematical Characters in Mac
On Mac computers, you can add mathematical operators and characters from the toolbar at the top. Simply click on Edit » Emoji & Symbols or press Command + Control + Space keys on your keyboard.
This will bring up the ‘Character Viewer’ app in a popup. From here, you can select the symbols and characters that you want to insert.
Simply double-click on a character to insert it in the WordPress post editor.
You can also format characters in the post editor using the subscript and superscript options in the paragraph toolbar.
2. Adding Unicode Mathematical Characters in Windows
Windows users can use a similar app to insert mathematical operators and special characters in the WordPress post editor.
Simply open the Character Map app by clicking on Start » Windows Accessories » Character Map. This will bring up the commonly-used characters on the screen.
The Character Map app supports many different encodings, including Unicode. You can find math operators by selecting the Unicode Subrange under Group.
After locating a character, you need to click to select it and then copy it. Now switch back to the WordPress content editor and paste the character.
Manually adding special characters and mathematical operators is a hassle, but it works if you’re only adding this once in a while.
However, if you regularly need to write mathematical equations on your site, then you will be better off learning to use either of the two methods described below.
Method 2: Writing Math Equations in WordPress Using LaTeX
LaTeX is a typesetting standard explicitly designed for writing technical and scientific documentation.
It is widely used in academic circles and is considered the de facto standard for writing equations and other scientific documents.
The official LaTeX website has detailed documentation and links to the tutorials and guide that will help you learn how to use it.
We will focus on how to bring LaTeX typesetting to your WordPress website.
First, you need to install and activate the MathJax-LaTeX plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.
Upon activation, you need to edit the post or page where you want to insert a math equation. On the post edit screen, click on the add new block button (+) and insert the Shortcode block into your content.
Inside the Shortcode block, you need to add the shortcode in the following format:
[latex]your LaTeX code here[/latex]
You can now save your post and preview it to see your math equation with formatting.
This is how it looked on our demo WordPress website.
An easier way to generate the code that you need is by using an offline LaTeX app for your operating system.
Alternatively, you can also use a web-based LaTeX environment like Overleaf.
You can then copy and paste your equations into the Shortcode block in WordPress.
Method 3: Writing Math Equations in WordPress Using MathML
MathML is a markup language designed to easily publish mathematical equations on the web. It uses a semantic XML markup similar to HTML.
WordPress doesn’t support MathML out of the box, and if you added the MathML code in the post editor, then it will not render correctly.
Luckily, there is a plugin that solves that problem.
Simply install and activate the MathML Block plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.
Upon activation, simply edit the post or page where you want to add the math equation. On the post edit screen, click on the add new block button (+) and add the Custom HTML block to your content.
You can now paste your MathML code inside the custom HTML block.
It should look something like this.
After that, you can save your post or page.
When you view it in a new tab, you will see MathML beautifully transformed on your website.
MathML Block uses the MathJax JavaScript engine to convert your markup into readable math equations. It also supports LaTeX commands.
To add your LaTeX code, simply add the MathML block to your content editor.
In the MathML block’s text area, you can paste your LaTeX code like this:
\[ your equation goes here\]
You can now save and preview your post to see it displayed in your blog post or page.
We hope this article helped you learn how to add math equations in WordPress. You may also want to see our expert picks for the best WordPress calculator plugins and our guide on how to write a great blog post.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Syed Balkhi says
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
Agu Sunday says
It was really helpful. it has solved the problem of many months of watching a lot of video without success. Thanks you so much
WPBeginner Support says
Glad our recommendation was helpful
Admin
Ioannis Giftakis says
Do you also know a WP Plugin that allows to put math formulas in comments also?
WPBeginner Support says
The second option from this article should be what you’re looking for
Admin
Ira Grossman says
I read on a Mircrossoft page that the shortest way to get to character map is to type “map” in the search bar and then select it from the list. Works for me, but with all things Windows you should check it out.
WPBeginner Support says
Thanks for sharing another way to find the character map
Admin