Hacker News new | past | comments | ask | show | jobs | submit login

Yes, we need something better. The correct solution is to have Unicode combining characters, as anything else will require a lot of separate work to be properly supported.

To think about how Unicode combining characters could work, just look at what Mathematica can do with just a few shotkeys: like ctrl-2, ctrl-- (ctrl-5), ctrl-6, ctrl-7 etc.

The matching Unicode combination characters would respectively be: place under a square root, put a something to the right below (and above), put an exponent, put something over.

With these 6 combining characters, you could already solve a large part of the problem and write 90% of the equations: for ex, if you want to type the sum of i=1 to 10 of the square root of alpha to the k bar power:

Type: 𝚺 (ctrl--) i=1 (ctrl-5) 10 (ctrl-2) α (ctrl-6) k (ctrl-7) _

With a proper keymap or shortcuts support, you could write (and render) equations just as fast as you write them by hand. I know, because I take all my notes with Mathematica and the only "magic" I use beside Mathematica combining shortkeys is a third level Unicode mapping for greek letters and some mathematical symbol like infinity, so that AltGr a gives me alpha, AltGr 0 gives me infinity etc.

Also, unlike what you read above, where only sigma and alpha stand out, it would show up in your browser, and you could copy-paste that in any email or text forum -- like HN or reddit!! No need for MathML support, that would be implemented straight in the Unicode rendering engine with the next batch of Unicode changes.

I have been trying to get some people involved, to try to submit a Unicode Math proposal. Nobody seems interested. Maybe with MathML dead, proper Unicode math combining characters will have a better chance.

(NB: in the above, I do not use a combining over bar for k, even if that is possible at the moment with what I think is called a macron. The idea is more general - what if you want to write a letter instead of just a bar over k? we have a few exponents like numbers and latin letters, but what if you want to write greek letters to the top right corner?)




I don’t think shoving all of this complexity in the already incredibly complex OpenType text shaping engines is a good solution here.

Your matrix example below is a good example of the can of worms that opens: there’s an explosion of internal state in the layout engine and a lot of things that Unicode has at least some success in defining (like “are these strings the same except for case” or “when is a set of codepoints a single character”) would become even harder and the set of badly handled corner cases would explode. It’s also unlikely you’d want to have it map that closely to Mathematica’s key bindings since those are designed to let you do things out of order and/or change things.

In the end you’ll just be shifting who ends up refusing to implement your standard from the browser engine to a lower level.


It's a neat idea, but I'm not entirely sold.

How would you implement, amongst others: vectors and matrices, matched auto-sizing delimiters (\left and \right) \operatorname, \limits, \displaystyle, \textstyle? In my line of work, every other line of maths I write requires at least one of these LaTeX features.

Also: \underset / \overset, \underbracket / \overbracket


For vectors, they already exist in Unicode as combining characters so nothing fancy is needed. Just map one of your keys to U+20d7 and use that as you would with an "accent", like the French acute or the German umlaut. Cf http://www.fileformat.info/info/unicode/char/20d7/index.htm

For matrices, here is how you can do it Mathematica style : a (ctrl-enter) b will put b vertically under a, "matrix style". Do it a few times if you need a few rows. (ctrl-), creates additional columns. You need a grammar, with say separators of records, but it wouldn't be hard to defie, and there are already characters for that.

FYI, if you want a above b, but for the fraction a/b, use (ctrl-/) : it will likewise put one above the other, but separated by a bar

This isn't rocket science. It already works in Mathematica. It just requires defining combining characters and a grammar -- or instead of reinventing the wheel, we could reuse something like Mathematica's grammar, which is already quite efficient at that.

Of course, for more complex math, more combining characters will be needed. I just wanted to show here how it would be possible to support most of the casual math notation with a dozen Unicode combining characters.


Those aren't terribly more complicated than some of the rendering in existing languages. For instance ก้้้้้้้้้้้้้้้้้้้้


This is a really wonderful idea. I love the thought that math support could become as ubiquitous as support for unicode strings. (You could search the web for math!!!)

Math is a language, and right now probably the worst supported language in unicode (of those that have been added at all.) Philosophically, this really seems like the right place to put it.


https://news.ycombinator.com/item?id=14687936

There's actually some work on that.


Though I agree with the top comment that the line cited is hardly legible:

W_δ₁ρ₁σ₂^3β = U_δ₁ρ₁^3β+1/8π^2 ∫_α₁^α₂dα'₂ [(U_δ₁ρ₁^2β-α'₂U_ρ₁σ₂^1β)/U_ρ₁σ₂^0β]

Now imagine that same example with the few combining characters I proposed: W_δ₁ρ₁σ₂^3β becomes W (ctrl--) δ₁ρ₁σ₂ (ctrl-5) 3β and it would render much more nicely.


The applications that support this Unicode Math today (Microsoft's Office) provide a lot of typing shortcuts including converting LaTeX \tags into their equivalents. I think the balance in the "plain text" over-verbose rendering of the Unicode Math was to make sure it copy/pastes adequately and flaws in that a bit easier to spot in "plain text" form outside of document math zones and math-supporting OpenType fonts, than some of the combining character options might yield.


I think you also need parenthesis, in mathematica they are inplicititally inserted in the notebook W (ctrl--) δ₁ρ₁σ₂ (ctrl-5) 3β {W (ctrl--) δ₁}ρ₁σ₂ (ctrl-5) 3β {W (ctrl--) δ₁ρ₁}σ₂ (ctrl-5) 3β {W (ctrl--) δ₁ρ₁σ₂} (ctrl-5) 3β

I believe that such a standard would be extremely non-extensible.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: