TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

249 pointsby s1291about 3 years ago

18 comments

rectangabout 3 years ago
Did Github ever solicit feedback from the community for this feature? Was there ever a beta before they rolled it out?<p>Because some of these critiques really should have been dealt with beforehand and I&#x27;m concerned that we&#x27;re now stuck with lousy defaults that they won&#x27;t ever be able to change.<p>The visual font size problem seems particularly disastrous:<p>&gt; <i>The math font is a really small,</i><p>&gt; <i>MathJax’s default font MJXTEX-I and GitHub’s default text Helvetica have a different x-height&#x2F;cap-height ratio.</i><p>I don&#x27;t understand how Github could launch this feature with this problem unaddressed. LaTeX isn&#x27;t just about getting formulas right, it&#x27;s about communicating ideas.
评论 #31458054 未加载
评论 #31466891 未加载
pxeger1about 3 years ago
This does seem like a remarkably poor implementation, especially given the alternatives: GitLab, mentioned; StackExchange also has a pretty decent implementation; many markdown-based static site generators also have good support
thaumasiotesabout 3 years ago
&gt; advantages of KaTeX:<p>&gt; It’s faster.<p>&gt; You can copy-and-paste math.<p>Someone mentioned that you can theoretically copy-and-paste KaTeX output in an earlier thread about GitHub&#x27;s new math rendering too. But I think calling that an &quot;advantage&quot; is crazy.<p>LaTeX will transform your one-dimensional textual formula specification into a two-dimensional graphical formula. The concept of copying and pasting the output as text is a category error. It isn&#x27;t text and if you try to paste it, you&#x27;ll get something other than what you wanted.<p>Just to be sure I&#x27;m not crazy, I tried copying the output of the demo on the KaTeX homepage. Here it is:<p>&gt; f(x)=∫−∞∞f^(ξ) e2πiξx dξ<p>This is much, much, much worse, if you want a textual representation, than copying the LaTeX source:<p><pre><code> \f\relax{x} = \int_{-\infty}^\infty \f\hat\xi\,e^{2 \pi i \xi x} \,d\xi </code></pre> And it&#x27;s worse even though the raw source includes the quirk that LaTeX isn&#x27;t able to provide proper spacing for the differential over which an integral is being calculated, so you have to space it yourself with \, commands.
评论 #31459207 未加载
评论 #31461380 未加载
hprotagonistabout 3 years ago
A source block type would have been a very natural fit, it’s surprising that isn’t how they chose to go.<p><pre><code> ```equation e^{i\pi}+1\eq0 ``` </code></pre> feels like what i’d try to do right off the bat.
评论 #31457908 未加载
评论 #31457458 未加载
评论 #31457435 未加载
评论 #31459094 未加载
patrick451about 3 years ago
&gt; The reason why I’m so excited about this feature is that, in combination with version control and the issues&#x2F;discussions capabilities in GitHub, I can see tectonic changes in how we’re publishing science. At last, science can really reap the benefits of a connected internet by moving away from static PDFs to living, breathing repositories which render like PDFs and provide a central place where one can actually talk about the article. – And fix bugs!<p>I&#x27;m skeptical of this take. Gitlab has had math rendering support for quite a while now, so this is hardly novel and doesn&#x27;t seem to have resulted in the utopia the author is hoping for.
评论 #31459341 未加载
评论 #31466992 未加载
jaltekruseabout 3 years ago
One thing that the article gets wrong is accusing mathjax of being abandoned. Development has moved to a new repo for the next version.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;mathjax&#x2F;MathJax-src&#x2F;graphs&#x2F;contributors" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mathjax&#x2F;MathJax-src&#x2F;graphs&#x2F;contributors</a>
评论 #31466931 未加载
评论 #31458205 未加载
fiddlosopherabout 3 years ago
Note also that TeX math can contain \text{..} which can itself contain $-delimited TeX math, e.g. $x = \text{my $y$}$. This currently breaks the GitHub implementation.
bewuethralmost 3 years ago
I tried all the examples using<p><pre><code> pandoc --from markdown --to html --mathjax </code></pre> i.e., using pandoc Markdown[1] with MathJax enabled, and it has none of the problems described in the article (see output[2]). The problem doesn&#x27;t seem to be due to MathJax, and even using GitHub Flavored Markdown as the input format to pandoc produces the correct results.<p>[1]: <a href="https:&#x2F;&#x2F;pandoc.org&#x2F;MANUAL.html#pandocs-markdown" rel="nofollow">https:&#x2F;&#x2F;pandoc.org&#x2F;MANUAL.html#pandocs-markdown</a><p>[2]: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;bewuethr&#x2F;691b4870828d7b2261113f14eef56b5f" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;bewuethr&#x2F;691b4870828d7b2261113f14eef...</a>
评论 #31476389 未加载
atomashevicabout 3 years ago
I completely agree with the conclusions, GitHub repositories can really be the focal point of scientific publishing in years to come.<p>I always wondered why it took so long to implement math. There are better implementations out there for sure, it&#x27;s weird they waited for so long and implemented something that is below the standard of alternatives.<p>The next step is to render citations from .bib files. I hope they get that right in the future.
throwaway981572about 3 years ago
I’m very happy they went with simple $..$ and $$…..$$<p>This is much more natural for anyone doing math or science and also makes it easy to copy and paste math from elsewhere<p>It’s better that the parser works harder than to force an inconvenient syntax on the user.
评论 #31460648 未加载
评论 #31459990 未加载
评论 #31466967 未加载
runarbergabout 3 years ago
The author fails to mention MathML as an alternative choice. The options aren’t just MathJax and KaTeX, but also raw MathML. MathML gives you extremely fast rendering, more font choices, copy-paste, a11y, etc. out of the box. The only downside is that Chrome is lagging behind in implementation, for that they could use MathJaX as a polyfill—as MathJax understands and is able to transform MathML—and allow Safari and Firefox users the benefits of using browsers that can render math natively.
评论 #31458956 未加载
评论 #31476449 未加载
nmalagutiabout 3 years ago
My theory is that there’s already a lot of existing content using $ and $$ that GitHub wants to start rendering without requiring any changes.<p>I agree the code block approach would be less ambiguous, but there is an advantage in going where people already are.
评论 #31458204 未加载
评论 #31476419 未加载
williamsteinabout 3 years ago
If you use a proper markdown plugin to parse math instead (such as <a href="https:&#x2F;&#x2F;github.com&#x2F;goessner&#x2F;markdown-it-texmath" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;goessner&#x2F;markdown-it-texmath</a>), then the problems pointed out in this blog post go away.
评论 #31476426 未加载
zitterbewegungabout 3 years ago
The way to really solve this is unfortunately for every equation that you have on Github you need to generate a png for each equation and just insert it into the file until Github fixes the various issues.
KolenChalmost 3 years ago
This article should not be taken seriously, which has at least 2 fatal errors in its argument.<p>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.<p>Then they made a claim about why putting math inside code delimiters are better.<p>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.<p>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.<p>Then why pandoc choose $ instead of \(…\) and \[…\]? And would that goes against the best practice of LaTeX?<p>The answer to the latter question is no, because the $ is the markdown delimiter, and when transpiled to LaTeX, it becomes the \(…\) and \[…\].<p>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.)<p>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.<p>The second fatal error is comparing MathJax to KaTeX by showing the commit freq. and claim that MathJax is dead.<p>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.<p>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.<p>MathJax is backed by a lot of organizations&#x2F;universities and they have commitment to maintain it. It is far from being dead.<p>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.<p>As GitHub doesn’t give you choice, choosing a default that has better coverage is no brainer.
评论 #31467061 未加载
cratermoonabout 3 years ago
Do \left and \right work for parens?
bla3about 3 years ago
&gt; Its main advantage over MathJax is that it isn’t dead. Check out the repo activity on the two projects:<p>I know this is a common view, but this is such a strange mindset to me. Unless you add scope, a project is eventually just mostly done. It&#x27;s not that MathJax has zero commits, it just has fewer. That _in itself_ isn&#x27;t a bad sign to me. It could just mean it&#x27;s a mature project.
评论 #31459427 未加载
评论 #31458208 未加载
niixabout 3 years ago
Completely tangential, but any recommendations on online complex math courses for engineers who haven&#x27;t been in school for 15+ years? :D
评论 #31465078 未加载
评论 #31463901 未加载