LaTeX/MathJax rendering bugs #36915
Replies: 7 comments 1 reply
-
Hi there @ilemhadri and welcome to our community 😄. Thanks so much for asking a great question! |
Beta Was this translation helpful? Give feedback.
-
The GitHub implementation of MathJax has a number of problems. Because LaTeX notation doesn't mesh well with Markdown notation, they have tried to handle that by quoting the LaTeX characters in ways that would prevent them from being processed by Markdown. Unfortunately, they haven't gotten in right, and there are a number of situations that they have not handled properly. One of them is underscores, which Markdown uses to indicate italics. So when you type
you get $\bar{X}{i,m} = X \Phi{i,m}^T$ Note that the text between the underscores is in italics and the underscores are missing, which means Markdown has replaced the underscores with HTML tags that indicate italics. MathJax doesn't process math that includes HTML tags, so that prevents MathJax from typesetting the result. Your example seems to not have the underscores at all, so it may be that when an item is posted, the processing is different (I will find out shortly when this is posted), but in the preview the math is not typeset due to the HTML tags for italic. You should be able to get it to work using
which produces though if they ever fix this problem, your equations will end up with actual underscores in the output, like |
Beta Was this translation helpful? Give feedback.
-
Added this to my math bug overview. https://github.com/nschloe/github-math-bugs |
Beta Was this translation helpful? Give feedback.
-
This is fixed by using the new inline math backtick delimiters: https://github.blog/changelog/2023-05-08-new-delimiter-syntax-for-inline-mathematical-expressions/
|
Beta Was this translation helpful? Give feedback.
-
For some reason, I couldn't find out, certain math expressions are not rendered (left as plain text). |
Beta Was this translation helpful? Give feedback.
-
I found a bug related to pre-processing underscores probably... Not working example$$
\begin{align*}
\text{Test}_b &= x_1\\
q_{y+1} &= q
\end{align*}
$$ Does not render: $$ I see this in the preview: Make it work using hackBut this does working using a hack that breaks other latex viewers $$
\begin{align*}
\text{Test}_b &= x_1\\
q\_{y+1} &= q
\end{align*}
$$ I see this in the preview: |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Reading through this https://github.com/orgs/community/discussions/18897, it appears there were other bugs in the past and Github has fixed them.
This is an example of very simple laTeX expression that is still not rendering correctly in either Github or Github Enterprise
$\bar{X}_{i,m} = X \Phi_{i,m}^T$
whereas both
$\bar{X}_{i,m} = $
and$X \Phi_{i,m}^T$
render properly.This kind of issues are unfortunately blocking us from being confident in rolling out LaTeX usage more broadly in Markdown in Github.
Beta Was this translation helpful? Give feedback.
All reactions