Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equations not properly rendering in website, despite following documentation. #2757

Closed
BuddhiLW opened this issue Aug 9, 2021 · 3 comments
Closed

Comments

@BuddhiLW
Copy link

BuddhiLW commented Aug 9, 2021

Issue Summary

I'm using Artix Linux, DWM, with Clojure's Cryogen framework to write a blog.

I tried to put MathJax into the posts s. The website function as a markdown rendered to html (Jekyll, Hugo etc style). So, I use pandoc to convert Org-mode notes to Markdown.

This is the scripts in the head of every post:

<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script>
      MathJax = {
	  tex: {
	      // packages: ['base,asm'],        // extensions to use
	      inlineMath: [              // start/end delimiter pairs for in-line math
		  ['\\(', '\\)']
	      ],
	      displayMath: [             // start/end delimiter pairs for display math
		  ['$$', '$$'],
		  ['\\[', '\\]'],
		  ['\begin{equation}', '\end{equation}']
	      ],
	      processEscapes: true,      // use \$ to produce a literal dollar sign
	      processEnvironments: true, // process \begin{xxx}...\end{xxx} outside math mode
	      processRefs: true,         // process \ref{...} outside of math mode
	      digits: /^(?:[0-9]+(?:\{,\}[0-9]{3})*(?:\.[0-9]*)?|\.[0-9]+)/,
              // pattern for recognizing numbers
	  }};
    </script>

Steps to Reproduce:

  1. Have leiningen installed in your system.
  2. git clone https://github.com/BuddhiLW/Blobing.git
  3. cd Blobing
  4. lein serve
  5. http://localhost:3000/

This is what gets rendered:

pic-selected-210809-1221-05

@pkra
Copy link
Contributor

pkra commented Aug 9, 2021

The markdown conversion messes up the TeX markup before MathJax gets to it. See http://docs.mathjax.org/en/latest/input/tex/html.html?highlight=markdown#interactions-with-content-management-systems and most of https://github.com/mathjax/MathJax/issues?q=markdown for many (many) discussions.

@BuddhiLW
Copy link
Author

BuddhiLW commented Aug 10, 2021

Ok!

Well, in general I exchanged $<code>$ for \( <code> \) and \(e^2_M\) for \(e\^2\_M\).

It worked. Although, it will be very annoying to do that by hand every time. Well... Anyhow, thank you!

@pkra
Copy link
Contributor

pkra commented Aug 10, 2021

It worked. Although, it will be very annoying to do that by hand every time. Well... Anyhow, thank you!

Some markdown parsers have support for ignoring TeX fragments built in or via plugins (e.g., kramdown, markdown-it). This usually makes things easier for authors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants