How to Write LaTeX Code in WordPress Using Jetpack Plugin

If you have installed WordPress on your own server, you won’t be able to use LaTeX features by default. However, if you are using WordPress’s hosting service, LaTeX functionality is available without the need for additional plugins, likely due to Jetpack support. This post is specifically for users who are not utilizing WordPress’s hosting service.

There are several plugins that enable LaTeX functionality, allowing you to write LaTeX code and create beautiful mathematical formulas. However, many of these plugins have not been recently tested, making it risky to rely on them with the latest version of WordPress. On the other hand, the Jetpack plugin is actively maintained and tested with every new WordPress release, ensuring compatibility and reliability. For this reason, I will show how to use the Jetpack plugin to write LaTeX code.

Steps to Enable LaTeX Using Jetpack
Step 1: Install Jetpack

From your WordPress Admin panel, go to Plugins > Add New and search for “Jetpack”. Install and activate the plugin.

Step 2: Connect to WordPress.com

WordPress now requires all users to connect their site and account to the WordPress.com cloud to enable certain features, including LaTeX. If you do not already have a WordPress.com account, you will need to create one. Once Jetpack is installed, navigate to the Jetpack Dashboard in your WordPress Admin panel, where you will find a link to complete the connection process. Follow the instructions to set up the connection.

Step 3: Enable LaTeX Features

Once your site is connected to WordPress.com, go to Jetpack > Settings > Writing in the WordPress Admin panel. Under the “Composing” section, toggle on the option labeled “Use the LaTeX markup language to write mathematical equations and formulas” (shown in the below figure). This activates the “Beautiful Math” module within the Jetpack plugin.

LaTeX Jetpack setup
Writing LaTeX Code in WordPress

Now that LaTeX is enabled, you can start writing LaTeX code in your WordPress posts. When adding LaTeX to your post, it is recommended to use the Code Block in the WordPress editor. This ensures proper formatting and allows you to write your LaTeX code across multiple lines for better readability. While you can use the Paragraph Block for LaTeX, it is less visually organized compared to the Code Block.

To include LaTeX code in your post, use the following syntax:

$latex your-latex-code-here$

Here is an example:

$latex 
\text{Weighted Average} = \frac{\sum_{i=1}^{n} w_i \cdot x_i}{\sum_{i=1}^{n} w_i} \\ \\
\text{where, }w_i \text{: weight of the } i^{th} \text{ item, } x_i \text{: value of the } i^{th} \text{ item}&s=2
$

When the post is published, the above code will produce the following formatted equation.

Latex math formula
Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.