stevengj / subsuper-proposal

Draft proposal for additional sub/superscript characters in Unicode
217 stars 9 forks source link

Application to in-terminal math rendering #2

Open stevengj opened 8 years ago

stevengj commented 8 years ago

In https://github.com/ipython/ipython/pull/6380#issuecomment-242827183, @asmeurer commented:

We use subscript and superscript characters to do math formatting for SymPy in the terminal, but the lack of certain letters limits what we can use

It would be good to comment on this application in the proposal as well, although I think that programming languages should be our main focus.

asmeurer commented 8 years ago

Well Python is pretty limited in what characters it accepts as variable names. x₉ isn't allowed. xᵢ is allowed but is treated the same as xi. I don't know the full details, but the character set allowed is based on what Unicode defines as "letter or number like", so for this proposal to be fully useful for Python, under your current focus, it should also require subscript letter/number characters to be treated as such. (I would open a new issue, but I don't know all the technical details)

asmeurer commented 8 years ago

It's worth noting that Unicode already has some existing semantics for using special characters for layout. A prime example is box drawing characters. An example from mathematics is (INTEGRAL EXTENSION), which exists to connect and . This character is only needed if you are rendering mathematics in plain text. If you have control over the layout of characters you can just use a large .

The fact that the fonts in question are monospace is irrelevant (although for things like box drawing characters fonts are expected to line things up correctly regardless of their width). The key point is the use of Unicode characters to render things using only text, which might be otherwise renderable via other facilities. Plain text representation of mathematical expressions (monospace is irrelevant for subscripts) is a great example of this.

Subscript characters strictly speaking aren't layout related, but I think a (careful) argument can be made that Unicode already has support not only for specific mathematical characters (like ⨯ and what have you), but for limited plain text layout using those characters. Just as

⌠
⎮
⌡

exists for those who can't just use a big , subscript characters should exist for those who can't just use small versions.

Of course, I could be way off. We might want to do more research on INTEGRAL EXTENSION to make sure what I just said isn't completely untrue.

stevengj commented 8 years ago

Regarding the allowed identifiers in Python 3, see https://github.com/stevengj/subsuper-proposal/issues/3#issuecomment-242913379