markup icon indicating copy to clipboard operation
markup copied to clipboard

Markdown doesn't recognize \operatorname anymore

Open kasparthommen opened this issue 2 years ago • 22 comments

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$

kasparthommen avatar May 03 '23 06:05 kasparthommen

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?

mdehling avatar Jun 09 '23 01:06 mdehling

Also seeing this. Please fix.

3f6a avatar Aug 28 '23 20:08 3f6a

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.

WesleyMcGinn avatar Aug 31 '23 01:08 WesleyMcGinn

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 $$

mdehling avatar Aug 31 '23 22:08 mdehling