How to use Latex on jekyll?

I am currently hosting my webpage on jekyll. What is the easiest way to display equations in my blog?

2 Likes

Maybe not exactly what you are looking for, but I recently found this https://shd101wyy.github.io/markdown-preview-enhanced/#/math

1 Like

Instructions from LaTeX in Jekyll worked fine for me.

TL,DR

  • Add the following line to _layouts/post.html:
    • <script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
  • Test out by adding the markdown I’ve provided below to one of your posts.
# Testing out latex

$$ \nabla_\boldsymbol{x} J(\boldsymbol{x}) $$

You should see something like this:

Code for the jekyll blog I’m using this in can be found GitHub - ian-whitestone/ian-whitestone.github.io, cloned from the github repo barryclark/jekyll-now (discourse isn’t letting me post more than 2 links :slightly_frowning_face: ).

4 Likes

@brando90 for future reference, rather add some more info in your question based on the guidelines on StackOverflow or similar.

Such as show some attempts of code you tried or at least links to tutorials or plugins you have already researched and maybe haven’t tried yet. Then we can comment on the quality of what you find or which is more relevant or easy, or we can recommend something you missed but that we like working with.

You can also make your question less broad. Like show some equations you want to use, describe if you are using GH Pages, etc. Or request not just the name of a plugin but request a snippet too.

You can also let us know if you have already searched through Latex questions on Jekyll forums and why the tools used there are not suitable or if you need guidance on choosing or using one