Live data from Hacker News

KaTeX: Math typesetting for the web

khan.github.io

51–60 of 101 posts

Re: KaTeX: Math typesetting for the web

#51

No xy support yet...

I've never heard of this before, could you let me know what it is?

Probably: http://www.ctan.org/pkg/xypic

Support for tikz would be great, too.

More broadly: great project! Looks to bring us closer to the day when math on the web is easy and just works.

If you don't mind me asking, can you say why you didn't work with MathJax, and decided to start over?

Re: KaTeX: Math typesetting for the web

#52

Earlier quoted context omitted.

So is your goal to be a faster MathJax-compatible alternative? We currently use MathJax, but there's definitely a need for faster rendering. As an example, we sometimes run a page load through wkhtmltopdf, and MathJax content can take a LONG time EDIT: Thanks for replying to my comment in spite of the downvotes

Yep, that's our goal. Khan Academy does a bunch of math rendering, and our exercises were suffereing because of it. Hopefully some time we'll be able to stop using MathJax.

Well you've convinced me. I'm gonna go ahead and download it now and try to use it everywhere MathJax is used. If it works with what we have I might be able to sell this to my bosses

Re: KaTeX: Math typesetting for the web

#53
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.

This is what you want:

http://webdemo.myscript.com/#/demo/equation

Re: KaTeX: Math typesetting for the web

#54

Earlier quoted context omitted.

Unfortunately, we're not. We might support that in the future though.

Very cool anyway. Because you are just using CSS instead of the DOM trickery of MathJax I should still be able to use it for my purposes.

Even though we're using CSS as much as possible, we do need the character metrics in order to do positioning properly. (For example, $x^2$ and $F^2$ differ in the vertical position of the 2.) You'll need to update these metrics to use it with a different font -- see

https://github.com/Khan/KaTeX/blob/master/src/fontMetrics.js

and the "make metrics" Makefile rule. We haven't added the ability to swap font metrics at runtime or to easily build a version with different metrics but I'm not opposed to the idea.

Re: KaTeX: Math typesetting for the web

#55

Earlier quoted context omitted.

I've never heard of this before, could you let me know what it is?

Probably: http://www.ctan.org/pkg/xypic Support for tikz would be great, too. More broadly: great project! Looks to bring us closer to the day when math on the web is easy and just works. If you don't mind me asking, can you say why you didn't work with MathJax, and decided to start over?

Ah. Yes, the diagram generating libraries are harder to implement. Since we don't actually implement the primitives that TeX uses, we can't just import libraries like xypic or tikz wholesale, we'd have to rewrite them from scratch. Maybe a project for when we've got most of the actual math working.

As for why we didn't work with MathJax, this started out as more of an internal project for making our own math fast, and has slowly built up to what we have today.

We also didn't think that we could get the speed we wanted while still supporting all of the obscure features MathJax does (like SVG rendering).

Re: KaTeX: Math typesetting for the web

#56

Looks great! Will KaTeX support (c.q. integrate with) ASCIIMathML.js¹,²? AsciiMath is dubbed “TeX without backslashes”, or as “markdown for math”.³ (La)TeX input can become laborious, and the syntax gets difficultly readable, very rapidly. With AsciiMath syntax⁴ (and Unicode!⁵) you can write δA instead of `\delta A`, ½ instead of `\frac{1}{2}`, ((a,b),(c,d)) instead of `\begin{pmatrix}a & b \\ c & d \end{pmatrix}`, &…

We won't support ASCIIMath yet. There's a lot of content on the web already in LaTeX syntax (and on our own website), and a lot of people already know it. It is difficult to use and read, but it gets the job done. Maybe once we've gotten all of the core LaTeX features done, we'll start looking to this. Thanks for the info, though!

Re: KaTeX: Math typesetting for the web

#57

Earlier quoted context omitted.

Yep, that's our goal. Khan Academy does a bunch of math rendering, and our exercises were suffereing because of it. Hopefully some time we'll be able to stop using MathJax.

Well you've convinced me. I'm gonna go ahead and download it now and try to use it everywhere MathJax is used. If it works with what we have I might be able to sell this to my bosses

Sounds great! If you have any problems, feel free to report issues on github, or join the #katex room on freenode.

Re: KaTeX: Math typesetting for the web

#58

Props to the coders for improving upon the LaTeX/Web use case space, but I can't help but feel something other than LaTeX is going to be necessary for the internet. LaTeX was fundamentally about document-level typesetting, and the internet is fundamentally not a place where that happens.

Well, I think for the use case most people use it for on the web, embedding a few equations in a web page, it's just fine, because everyone who writes about math already knows LaTeX. It doesn't really matter that no one is actually doing document-level typesetting on the web. It may be idiosyncratic in some ways but it's just too common to replace IMO.
Post reply on HN