nodejh / hugo-theme-mini

A fast, minimalist and responsive hugo theme for bloggers.

Home Page:http://nodejh.github.io/hugo-theme-mini

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mathematics in Cactus Plus

opened this issue · comments

Hi,

Thanks for your amazing theme. I'm trying to render mathematical notation and I've stumbled upon a few issues.

As a note, I'm using RStudio and the Blogdown package.

R version 3.5.1 (2018-07-02) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS High Sierra 10.13.6

I first started looking at a tutorial from another user of your theme, here.

Then I managed to sort out part of the problem using this resource. So now the mathematical notation appears when I use the $$ sign. However, there's some strange formatting around it that I don't understand where it comes from or how to clean up, is it that the theme treats the math snippets as code snippets? And if so, is it possible to do something about it?

screen shot 2018-10-30 at 14 29 30

Thanks

I hope I am not too late for this one, but here is a solution that uses katex instead of mathjax. Just paste this to the end of the layouts/partial/footer, just before the </footer>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/katex.min.css" integrity="sha384-9eLZqc9ds8eNjO3TmqPeYcDj8n+Qfa4nuSiGYa6DjLNcv9BtN69ZIulL9+8CqC9Y" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/katex.min.js" integrity="sha384-K3vbOmF2BtaVai+Qk37uypf7VrgBubhQreNQe9aGsz9lB63dIFiQVlJbr92dw2Lx" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.10.0/dist/contrib/auto-render.min.js" integrity="sha384-kmZOZB5ObwgQnS/DuDg6TScgOiWWBiVt0plIRkZCmE6rDZGrEOQeHM5PcHi+nyqe" crossorigin="anonymous"
    onload="renderMathInElement(document.body);"></script>

(I got the code from here)

You might have to add katex: true in the YAML of your Rmd files. Mine already had it because I was using another theme that requires that option.

Here it works fine, just like it should. It does not put a box around maths in-line (which I actually prefer)

Cheers