github / markup

Determines which markup library to use to render a content file (e.g. README) on GitHub
MIT License
5.83k stars 3.4k forks source link

Markdown doesn't recognize \operatorname anymore #1688

Open kasparthommen opened 1 year ago

kasparthommen commented 1 year ago

Until a short while ago (approximately 1-3 months, can't say for sure), using \operatorname in github gists worked just fine. Now it doesn't work anymore, see e.g. the following gist of mine:

https://gist.github.com/kasparthommen/d996b49b965a44dbfedc8677575a70ec

In fact, it doesn't work in this issue text either, see below.

$\operatorname{P}(A) = 1$

mdehling commented 1 year ago

I have the same issue -- latex code I wrote last year no longer renders correctly:

https://github.com/mdehling/kolkin-style-transport/blob/679ca79ded0d53963f69a883c40b561b439a4c42/README.md

Can this be fixed?

3f6a commented 1 year ago

Also seeing this. Please fix.

WesleyMcGinn commented 1 year ago

Yes, this is very strange. The \operatorname function in MathJax Markdown is extremely important, especially when using operators like floor() and ceiling(), which are typically not recognized as common math functions (so \floor cannot be used like \cos can).

Until Github fixes this, here is a temporary solution: You can use \text instead of \operatorname...

Does Not Work:

Code:

$$ \operatorname{floor}(x) $$

Output:

$$ \operatorname{floor}(x) $$

Works (sort of):

Code:

$$ \text{floor}(x) $$

Output:

$$ \text{floor}(x) $$

The downsides to using this method are:

  1. It doesn't look exactly the same as other mathematical operators such as sin() and cos().
  2. It doesn't have built-in spacing around it like other mathematical operators do.
  3. It is somewhat unprofessional to put annotation text into an equation where an operator is supposed to be, for those who are actually looking into the markdown code.

This could be working on some computers but not others. For those of you who don't see any error in the section labeled "Does Not Work", here is an image of what we are seeing: image

Please fix this very soon. People shouldn't have to use PDFs instead of markdown files just so that they can show a simple math function in an equation.

mdehling commented 1 year ago

As a workaround, you can use \mathop with \text to get the correct spacing for an operator:

$$ 2 \mathop{\text{tanh}} x = 0 $$

results in

$$ 2 \mathop{\text{tanh}} x = 0 $$

github-actions[bot] commented 2 months ago

Stale issue message

3f6a commented 2 months ago

The issue is not resolved

github-actions[bot] commented 2 days ago

Stale issue message

NathanielJS1541 commented 2 days ago

This issue is still not fixed. Bumping to stop it from being automatically closed.