AllenDowney / ThinkBayes2

Text and code for the forthcoming second edition of Think Bayes, by Allen Downey.
http://allendowney.github.io/ThinkBayes2/
MIT License
1.8k stars 1.49k forks source link

Formulas Not Displaying Properly in github.io version #67

Closed alexander-ye closed 8 months ago

alexander-ye commented 11 months ago

Formulas in the github.io version of the book are not displaying properly—they are still in their raw LaTeX syntax.

Exmaple: https://allendowney.github.io/ThinkBayes2/chap02.html

joac commented 11 months ago

As a workaround I'm pasting on the page console

window.MathJax = {
  tex: {
    inlineMath: [['$', '$'], ['\\(', '\\)']]
  },
  svg: {
    fontCache: 'global'
  }
};

(function () {
  var script = document.createElement('script');
  script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js';
  script.async = true;
  document.head.appendChild(script);
})();

To activate matjax Source

I didn't found the sphinx config. @AllenDowney If you can point me in the right direction I can provide a pr to fix it.

Bearsetc commented 8 months ago

@AllenDowney - The myst extension attrs_inline seems to be causing the conflict with dollarmath. Please try the update to _config.yml shown below. I have not checked if you use the attrs_inline feature in the book, but if you can live without it, hopefully this is a fix. Happy Holidays!

parse:
  # myst_extended_syntax: true  # instead enable individual features below
  myst_enable_extensions:  # https://myst-parser.readthedocs.io/en/latest/using/syntax-optional.html
    - amsmath
    # - attrs_inline  # causing the conflict with dollarmath
    - colon_fence
    - deflist
    - dollarmath
    - fieldlist
    - html_admonition
    - html_image
    - linkify
    - replacements
    - smartquotes
    - strikethrough
    - substitution
    - tasklist
AllenDowney commented 8 months ago

@Bearsetc That worked. Thank you so much!