Live data from Hacker News

Math on GitHub: The Good, the Bad and the Ugly

nschloe.github.io

51–60 of 71 posts

Re: Math on GitHub: The Good, the Bad and the Ugly

#52
post #13

Earlier quoted context omitted.

A code block is used to display text literally, except adding syntax coloring. You would use it to display TeX source notation for example. A math block transforms TeX into something else, it's entirely different. I think it's correct that they did not use the code block syntax for this.

It's how Github already handles Mermaid diagrams, so there's precedent, although you're correct that logically there should be a distinction between "display highlighted Mermaid source" and "render Mermaid diagram".

Yes, and now they've reached a dead since they have no way to render mermaid source code except as plain text or by introducing a new name like mermaid-src. It's minor but it's unsatisfying conceptually. I'd rather have them introduce a new "run delimited text into external program and replace by output" tag.

Re: Math on GitHub: The Good, the Bad and the Ugly

#53
post #39

Earlier quoted context omitted.

This is why I prefer AsciiDoc. It's consistent because there's only one implementation, it's less ambiguous, and more predictable. Although it takes a bit longer to remember all the syntax, it's not difficult, especially if you're only going to use the same subset of features that markdown supports since it supports most of the markdown syntax as well. I also much prefer the flexibility with tables compared to markdo…

Looks crazy verbose compared to $ and $$, especially if you're actually using it intensively.

True, it's more verbose, but I'd take increased verbosity and standardization over increased ambiguity and inconsistency since every markdown parser and renderer translates things a little differently, which is why there's things like Babelmark[0]. That verbosity also provides consistent, more powerful features like multi-line table cells, table cell spanning, table nesting, sidebars, admonitions, footnotes, table of contents, image embedding, cross-doc references, latex-like includes, etc. that all follow a similar inline and block syntax and are rather clear from a glance.

It's certainly not perfect, but I much prefer it for the flexibility and consistency to the dozens of markdown implementations that all do things a little different and not needing to drop down into HTML when I need to do something just outside of markdown's capabilities.

0: https://babelmark.github.io/

Re: Math on GitHub: The Good, the Bad and the Ugly

#54
post #50

Completely tangential, but any recommendations on online complex math courses for engineers who haven't been in school for 15+ years? :D

What do you want to use it for? There’s complex math for physicists (differential equations and linear algebra), and there’s complex math for mathematicians (i.e complex analysis, functional analysis, etc).

It’s all pretty much the same thing, but the emphasis is different depending on if the objects of your study are physical or non-physical.

Re: Math on GitHub: The Good, the Bad and the Ugly

#55
This article should not be taken seriously, which has at least 2 fatal errors in its argument.

First about the choice of delimiter. It argues for the use of \(…\) and \[…\] instead of $…$ and $$…$$. They don’t even explain why, but cite an external link to, guess what, a reason why the former is better for LaTeX, not markdown.

Then they made a claim about why putting math inside code delimiters are better.

Detouring a little bit, my guess that GitHub chooses this delimiter is because they have prior collaboration with the author of pandoc to create the common mark spec. Their GFM parser is an extension of a common mark parser.

And since pandoc chooses the dollar sign delimiter as the math delimiter, it is natural for them to choose it too, just to have lesser variants.

Then why pandoc choose $ instead of \(…\) and \[…\]? And would that goes against the best practice of LaTeX?

The answer to the latter question is no, because the $ is the markdown delimiter, and when transpiled to LaTeX, it becomes the \(…\) and \[…\].

Answer to the first question is related to the fact that at least in pandoc, \[ means escaping the [. So to type \[ in markdown, it should be \\[, which is cumbersome. (There’s a special flag in pandoc that you can use bare \(…\) and \[…\] though.)

And since all this parsing is happening at the parser level, the code-delimiter argument is invalid. They are thinking more in terms of hacking an existing parser and render math as a post-processing step.

The second fatal error is comparing MathJax to KaTeX by showing the commit freq. and claim that MathJax is dead.

This is a really amateurish argument seen occasionally elsewhere in the open source community that if a software has no recent commit history it is dead.

In this particular instance, KaTeX is far behind MathJax in terms of coverage of rendering valid LaTeX math. This alone means they have a lot of catch up to do and no wonder a less mature software has more commit activity than a more mature one.

MathJax is backed by a lot of organizations/universities and they have commitment to maintain it. It is far from being dead.

KaTeX aims at being fast (MathJax 3 reclaim that territory a bit but AFAIK KaTeX is still king in that aspect.) If the math you use can be rendered by KaTeX, then use it. But it happened to me that I have to change a config to use MathJax instead of KaTeX because soon or later I’m going to use something KaTeX doesn’t support.

As GitHub doesn’t give you choice, choosing a default that has better coverage is no brainer.

Re: Math on GitHub: The Good, the Bad and the Ugly

#56
post #17

Did Github ever solicit feedback from the community for this feature? Was there ever a beta before they rolled it out? Because some of these critiques really should have been dealt with beforehand and I'm concerned that we're now stuck with lousy defaults that they won't ever be able to change. The visual font size problem seems particularly disastrous: > The math font is a really small, > MathJax’s default font MJXT…

Author here.

> Did Github ever solicit feedback from the community for this feature? Was there ever a beta before they rolled it out?

There actually was a closed preview for this, but it wasn't long and the feedback I gave them (which is almost everything that's in the blog post) wasn't implemented.

> The visual font size problem seems particularly disastrous:

They made the decision to match the capital heights of the two fonts, not the x-heights. If they match the x-heights, the capitals in math mode will be too large.

Since the small letters are way to small, perhaps they'll increase math font size a little bit in the future to balance it out.

Re: Math on GitHub: The Good, the Bad and the Ugly

#57
post #17

Did Github ever solicit feedback from the community for this feature? Was there ever a beta before they rolled it out? Because some of these critiques really should have been dealt with beforehand and I'm concerned that we're now stuck with lousy defaults that they won't ever be able to change. The visual font size problem seems particularly disastrous: > The math font is a really small, > MathJax’s default font MJXT…

Small font size seems the easiest to fix. Kerning seems worse since people will manually tweak spacing with \, etc, so you can't just change it whenever you want.

Blog post author here. The kerning is probably a problem with their font config that can hopefully be fixed. I don't think -- and that's me personal estimation -- that people will write tons of `a\,=\,b` to work around the bad kerning, so that's a change I would still recommend making.

Re: Math on GitHub: The Good, the Bad and the Ugly

#58
post #13

A source block type would have been a very natural fit, it’s surprising that isn’t how they chose to go. ```equation e^{i\pi}+1\eq0 ``` feels like what i’d try to do right off the bat.

A code block is used to display text literally, except adding syntax coloring. You would use it to display TeX source notation for example. A math block transforms TeX into something else, it's entirely different. I think it's correct that they did not use the code block syntax for this.

Author here.

The main idea of using code blocks for math is to protect its content from being messed with. Markdown parsers do that by default, so that's how it's "natural". As you mention, the drawback is that you can't have a codeblock with syntax highlighting for a language called "math" (should there ever be one), but that seems like a small price to pay.

Re: Math on GitHub: The Good, the Bad and the Ugly

#59

One thing that the article gets wrong is accusing mathjax of being abandoned. Development has moved to a new repo for the next version. https://github.com/mathjax/MathJax-src/graphs/contributors

Author here.

Thanks for the hint! I had indeed overlooked that. I have updated the article accordingly.

Re: Math on GitHub: The Good, the Bad and the Ugly

#60

I’m very happy they went with simple $..$ and $$…..$$ This is much more natural for anyone doing math or science and also makes it easy to copy and paste math from elsewhere It’s better that the parser works harder than to force an inconvenient syntax on the user.

Author here.

One problems is that the parser doesn't work harder yet, and it will be difficult even for GitHub to make it so. The $-syntax is familiar to TeXies indeed, but if the cost is that math won't ever work properly, I'd rather have a markdowny syntax.

Post reply on HN