Enable Latex in Hugo
Nov 11, 2018
One minute read

I was able to add \(\LaTeX\) support to my hugo blog finally. Suprisingly adding it is not difficult with hugo blogs. All I needed to do is adding

<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-MML-AM_CHTML' async></script>

to theme/cocoa/layout/partial/head_includes.html. This might look different depending on the team that you are using. Now I am able to include some mathematical expressions using \\( or \\[ depending on whether I want the expression to be inline or display mode. For example, the following is Holder’s inequality in display mode: \[\sum_{i=1}^n x_iy_i \le \left(\sum_{i=1}^n x_i^p \right)^{1/p} \left(\sum_{i=1}^n y_i^q \right)^{1/q} \] which is fantastic. The only problem I am seeing is that some special characters in \(\LaTeX\) are special characters in Markdown as well. For example, _ means something in both languages. My work around at the moment is to escape the underscores until I find a more convenient solution.


Back to posts