minimal-mistakes: Kramdown does not seem to render math blocks

  • This is a question about using the theme.
  • I believe this to be a bug with the theme — not Jekyll, GitHub Pages or one of the bundled plugins.
  • This is a feature request.
  • I have updated all gems with bundle update.
  • I have tested locally with bundle exec jekyll build.

Environment informations

  • Minimal Mistakes version: 4.1.1
  • github-pages or jekyll gem version: github-pages 91
  • Operating system: OS x Sierra 10.12.2

Expected behavior

Kramdown does not render math when using the $$ \equation $$ syntax as prescribed on https://kramdown.gettalong.org/syntax.html#math-blocks.

Steps to reproduce the behavior

Here is a link to my repo. As you can see under e.g. under inverted pendulum.md there should be two bits of math $$ x_t $$ and $$\theta_t$$ which should display as math. But when building (or serving), it does not render.

I have forked Minimal Mistakes and implemented as shown. Everything else works fine.

Here are my _congif.yml settings for markdown:

Conversion

markdown: kramdown highlighter: rouge lsi: false excerpt_separator: “\n\n” incremental: false

Markdown Processing

kramdown: input: GFM hard_wrap: false auto_ids: true footnote_nr: 1 entity_output: as_char toc_levels: 1…6 smart_quotes: lsquo,rsquo,ldquo,rdquo enable_coderay: false

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 25 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Adding

<script type="text/javascript" async
  src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>

manually to my .md posts worked perfectly. Thanks. Any ideas on how to implement this in a more permanent manner?

I’d add it using a conditional like @justinrummel suggested to avoid embedding the script on pages that don’t need MathJax.

/_includes/scripts.html is probably the best place for it, but it can be added to one of the custom includes if you want to maintain to avoid messing with the main theme files.

Either way something like this:

{% if page.mathjax %}
<script type="text/javascript" async
  src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
{% endif %}

And then in your post/page’s YAML Front Matter you’d add mathjax: true if you wanted the script embedded.

For scripts that I want to add on every page, I usually add them to the _include/scripts.html page. I’ve also done some IF statements (which I’m sure are not the best way to do this) to see if I’m loading the main page or a “Search” page as seen on my repo: scripts.html

I tried above a few codes, but could not able to solve for mine. Later use below code, which solved the mathjax problem.

{% if page.mathjax %}
<script type="text/javascript" async
  src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
{% endif %}

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX", "output/HTML-CSS"],
    tex2jax: {
      inlineMath: [ ['$','$'], ["\\(","\\)"] ],
      displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
      processEscapes: true
    },
    "HTML-CSS": { availableFonts: ["TeX"] }
  });
</script> 

Hi @mmistakes just wanted to let you know that I got this working. I followed this and the solution from @yuzhangbit.

You can add it to scripts.html or any of the two custom includes I’ve added to the theme for injecting scripts in the head or footer. /_includes/head/custom.html

The solution you posted above (dnjs.cloudflare.com hosting) worked when I put it in the /_includes/head/custom.html.

Thank you!

So I rolled back to the non-beta version of Chrome and was able to reproduce it. The sidebar is there, but it disappears after the MathJax script loads and messes with the page’s CSS.

It’s doing a whole lot of stuff that hides the sidebar.

screen shot 2017-02-20 at 8 45 27 pm

You can edit the CSS for the .sidebar to fix it. Though this smells like a browser bug to me so it should be fixed when Chrome rolls out 57, as it works fine there and other browsers like Safari.

Removing the following from _sass/_sidebar.scss worked for me:

-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);

Thank you @sudhirln92. I was updating something else and that snippet helped.

As per Krandown’s docs you need to add the MathJax JavaScript library for it work. https://www.mathjax.org/