Writing math equations in WordPress can be challenging since the default editor doesn’t fully support mathematical formatting. However, there are ways to add equations to your site easily.
In this article, we’ll guide you through three different methods for writing math equations in WordPress. Whether you need simple formulas or complex equations, these techniques will help you display them correctly on your site.
By following these steps, you can ensure that your equations are clear, professional, and easy for your audience to read.
Why Is Writing Math Equations in WordPress Difficult?
Writing mathematical and scientific equations in WordPress is difficult due to the lack of support for the characters in HTML.
WordPress works dynamically by generating your website content and sending HTML output back to the users’ browsers to display.
Currently, MathML and LaTeX are considered the standards for writing mathematical and scientific equations on the web.
Unfortunately, we found them to be less than ideal for beginners. They both require you to learn their syntax, which could get complicated for longer and more complex equations.
That being said, let’s look at how to write math equations on your WordPress blog.
We will start with an easy solution 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 recommended for users who don’t frequently need to write math equations. For this method, you will use Unicode characters and insert them directly in the post editor.
Unicode is the encoding standard 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 the 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.
Open the Character Map app by clicking 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 tutorials and guides 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.
Note: The plugin may show a notice that it hasn’t been updated in a while, but we tested it on our website, and it worked fine.
Upon activation, you need to edit the post or page where you want to insert a math equation. On the post edit screen, click 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.
Using an offline LaTeX app for your operating system is an easier way to generate the code you need.
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 add the MathML code in the post editor, 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.
Note: The plugin may show a notice that it hasn’t been updated in a while, but we tested it on our website, and it worked fine.
Upon activation, start editing 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 on 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.
Dennis Muthomi
Oh, wow, good thing I came across this article, I have a client whose site is based on mostly math content.
The Unicode, LaTeX and MathML comparison is very helpful.
My client has been using the Unicode method but after reading this I’m inspired to try the LaTeX method with the MathJax-LaTeX plugin.
Agu Sunday
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
Glad our recommendation was helpful
Admin
Ioannis Giftakis
Do you also know a WP Plugin that allows to put math formulas in comments also?
WPBeginner Support
The second option from this article should be what you’re looking for
Admin
Ira Grossman
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
Thanks for sharing another way to find the character map
Admin