Live data from Hacker News

KaTeX: Math typesetting for the web

khan.github.io

41–50 of 101 posts

Re: KaTeX: Math typesetting for the web

#41
post #36

I may be the odd man out, but especially for the case where I modify a small part of an expression I like MathML because those small parts can be uniquely identified and altered without altering or reformatting the rest of the expression. MathJax supports MathML, so this is possible with MathJax. For example, the event handler that updates r at the bottom of this page: http://www.vizitsolutions.com/portfolio/gausslaw…

We don't use features like this at Khan Academy. However, most of the time the problems with MathJax were with the inital problem load, not with changing expressions later. It might be interesting to support something like that eventually! Let me know how it works for you.

Re: KaTeX: Math typesetting for the web

#42

Did Mathjax just become obsolete?

Not quite yet, but we're working on it. There are some significant features that KaTeX doesn't yet support, but we're working to add them in the near future. In the meantime, you could use our TeX React component to use KaTeX when possible, and fall back to MathJax only when necessary: http://khan.github.io/react-components/#tex

Sorry to tl;dr your code, but how exactly is it based on TeX? Do you actually run Knuth's TeX code to make this work, or did you reimplement it?

Also, kind of irrelevant, do you think we'll ever get something better than (La)TeX syntax? I've been frustrated by obscure error messages from LaTeX in big documents because it's a macro language, so the interpreter doesn't actually see what you're typing. How does KaTeX handle errors?

Re: KaTeX: Math typesetting for the web

#43
post #32

This looks really nice. Are there any handwriting recognition projects for being able to write on a wacom tablet that could output to a format like this? That was always my dream when doing homework at the university.

Microsoft has "Math Input Panel" built into Windows 7. It does not create LaTeX output and it is far from perfect, but it does allow you to write down an equation which is then typeset quite nicely.

http://windows.microsoft.com/en-us/windows7/use-math-input-p...

Re: KaTeX: Math typesetting for the web

#44
post #42

Earlier quoted context omitted.

Not quite yet, but we're working on it. There are some significant features that KaTeX doesn't yet support, but we're working to add them in the near future. In the meantime, you could use our TeX React component to use KaTeX when possible, and fall back to MathJax only when necessary: http://khan.github.io/react-components/#tex

Sorry to tl;dr your code, but how exactly is it based on TeX? Do you actually run Knuth's TeX code to make this work, or did you reimplement it? Also, kind of irrelevant, do you think we'll ever get something better than (La)TeX syntax? I've been frustrated by obscure error messages from LaTeX in big documents because it's a macro language, so the interpreter doesn't actually see what you're typing. How does KaTeX ha…

We reimplemented the TeX formatting algorithms in JavaScript. Most of them are in https://github.com/Khan/KaTeX/blob/master/src/buildTree.js (there are references to the pages from the TeXbook that the algorithms are on).

Also, we attempt to have relatively good error handling! If you open up the javascript console on the main page and type in a bad expression, you can see what the errors we throw look like. We're not planning on supporting anything other than LaTeX syntax for now though, unfortunately.

Re: KaTeX: Math typesetting for the web

#45

Is there support for alternate math fonts (not sure what the proper term is) like \mathbf, \mathcal, \mathbb? Couldn't get it working. Looks fantastic though.

There isn't yet, but we're working on it! We have the fonts ready, just haven't added those functions yet. Could you make an issue on the github page so we make sure we don't forget?

Will do right now.

Re: KaTeX: Math typesetting for the web

#48

Not bad, but MathJax is also pretty fast: https://trinket.io/latex/788599bf30

On my machine at least, the KaTeX demo is considerably faster. This is very useful for big math threads like often on terrytao.wordpress.com, which can take up to a minute to render in my browser. On mobile it's even worse.

Do you have any handy pointers to particularly long threads on terrytao or elsewhere?

Re: KaTeX: Math typesetting for the web

#49
post #32

This looks really nice. Are there any handwriting recognition projects for being able to write on a wacom tablet that could output to a format like this? That was always my dream when doing homework at the university.

I relied on this a lot during my university days: http://detexify.kirelabs.org/
Post reply on HN