In this post, I will show one trick to Mathjax-Latex plugin on WordPress so that the issue of “Undefined control sequence” could be resolved while displaying equations.
Introduction
As with many bloggers who writes articles with math equations, there is no better way to use \(\mathrm{\LaTeX}\). It is so easy to follow the syntax and write informative equations while composing articles. I like to write inline \(\mathrm{\LaTeX}\) equations and annotate text with symbols to be more informative. Sometimes I use those equations as a way to highlight texts, in other words I use equations to show texts than math symbols because it could express the meaning in a richer fashion, for example like this \(\underbrace{\textcolor{blue}{\text{Technical Term}}}_{\substack{\textcolor{green}{\text{explain}}}}\leadsto\textcolor{orange}{\text{Conclusion}}\). Mathjax is one javascript display engine for showing \(\mathrm{\LaTeX}\) based equations, which has been widely adopted among many influencial bloggers including Lillian Weng.
For my site, I’ve used other types of plugins for handling \(\mathrm{\LaTeX}\) equations. However, recently I found out that some of the plugins I use heavily has not been updated for a long time. Although they could display equations properly, I don’t know how long this could still holds. I installed one plugin Mathjax-Latex that support \(\mathrm{\LaTeX}\) equations after considering the out of date plugins that I was using. This new installed one is phonomenal, when you right click the equation being displayed, it allows you to even copy the \(\mathrm{\LaTeX}\) equation code, it would save a lot of time just to grab those code and reuse in other contexts. Nevertheless I argued that you could get any \(\mathrm{\LaTeX}\) code by taking a screenshot and feeding that into a large language model.
You could even try right click \(\textcolor{maroon}{\textrm{HERE}}\) and see the contextual menu provided from the Mathjax-Latex plugin and toy with it to see some of the interesting functionalities it provides. Normally you can see something like this.

The Displaying Issue
Undefined control sequence for example Undefined control sequence \geqslant
or maybe Undefined control sequence \nRightarrow
. Those math symbols could be found in amssymb although they are not provided by default. However, without the extended versions of symbols, it would constrain me to express equations adequately. I need to find out a solution to this.


Solution Tick
While checking the settings for Mathjax-Latex, I found that there are only a few options for me to customize. Perhaps the most relevant one is re lated to “Use MathJax CDN Service”. I took a shot and searched for alternative MathJax locations.

After checking online, I found mathjax’s official webpage that is related to the CDN servers and how to embed js code onto html. However, in our case, we don’t need to do too much, you could just copy the the following url and then paste it to the Custom MathJax location in MathJax-LaTeX settings. Obviously you need to unch eck Use MathJax location.
https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
BashWe could look deeper on this url and see how it works.
\(\underbrace{\textcolor{blue}{\texttt{https://cdn.jsdelivr.net/npm/}}}_{\substack{\text{cdn domain with the latest js}}}\underbrace{\textcolor{maroon}{\texttt{mathjax@3/es5/}}}_{\substack{\text{specific js version}}}\underbrace{\textcolor{red}{\texttt{tex-mml-chtml.js}}}_{\substack{\text{js for TeX and MathML}}}\)

After switching to another MathJax location, I’m able to display the symbols including \(\underbrace{\geqslant}_{\substack{\textcolor{green}{\texttt{\geqslant}}}}\) and \(\underbrace{\nRightarrow}_{\substack{\textcolor{green}{\texttt{\nRightarrow}}}}\). You don’t need to worry about the link I provided, this is recommended by Mathjax as an alternative CDN service. The default CDN service is quite outdated and may needs further configurations, some symbols are not shown and the error shows the symbols are undefined. What surprises me even more is that for the new MathJax location, there is no lag for rendering the equations when loading the page that contains the equations, it process is smoother than the default CDN service.
As I’m not a veteran on \(\texttt{javascript}\), it is a bit harder to handle this issue as I need to go one step further to do some customization, but the good thing it is that the process of figuring out the problem is not that difficult. In this post, I also try to add some flairs with equations and annotations to show those blocks could be really useful when explaning concepts.
Conclusion
This post presents a solution to handle Undefined sequence issue regarding \(\mathrm{\LaTeX}\) equations with MathJax-LaTeX on WordPress. By simply switching the CDN location, the issue could be easily solved. What I’ve learnt is to have a look at the documentation slightly would make a profound impact on how we could utilize and customize the tools at hand.
https://www.cmor-faculty.rice.edu/~heinken/latex/symbols.pdf
Leave a Reply