How to Post Math Formulas (LaTex) on WordPress

You might want to add math formulas to WordPress and do not know how to do it. The following is the method I have been using on this blog.

Step 1: Local Computer

You can use any software on your computer to write LaTex and check whether it looks okay. For instance, you can use RMarkdown to write it.

Step 2: Write in Pandoc.org

Use the Pandoc website, click the link here. The “begin displaymath” and “end displaymath” are the ones you need to add in addition to your math formula Latex.

\begin{displaymath}

y=\beta_0 +\beta_1x+\epsilon

\end{displaymath}

You just need to copy the code above and paste it into the left box. Choose LaTex from the dropout menu, and then hit Convert. Then, copy the code from the right.

Step 3: Paste to Custom HTML

You just need to paste the code into Customer HTML.

Step 4: Add MathJax as Custom HTML

Add the following javascript code as custom HTML as well.

<script type="text/javascript" async="" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML">
</script>

Step 5: Nothing, just see the results!

See you can see the formula below now!

\[y=\beta_0 +\beta_1x+\epsilon\]

Leave a Reply

Your email address will not be published.