Julia: Allow \u2e12 in variable names

Created on 21 Feb 2020  ·  6Comments  ·  Source: JuliaLang/julia

This came up in https://github.com/JuliaDiffEq/ModelingToolkit.jl/issues/247 where u₁⸒₂ would be great name for a generated symbolic variable in a matrix, but it is not allowed with the current punctuation rules in the parser. I would advocate for allowing this inside of variable names since right now it doesn't have another use.

parser unicode

Most helpful comment

It seems like it should be input as \_,<tab>.

All 6 comments

mᵢ⸒ⱼ⸒ₖ

Is there a latex sequence for this?

Not per se afaik. ($$m_{i,j,k}$$) ($_,$) though

Indeed the Latex we generate as output do m_{i,j,k}, but we can't have that as a variable name so we are trying to get as close as possible:

https://github.com/JuliaDiffEq/ModelingToolkit.jl/blob/v1.2.7/test/latexify.jl#L38-L51

Essentially what we're doing is taking in data and then spitting out the Latex for the physical laws that would generate the data, so we're trying to make our symbolic variables on the Julia side be symbols that are close to the Latex to make it easier to read and relate (since we're generating Julia code for the functions as well). What we're missing is a unicode subscript comma.

It seems like it should be input as \_,<tab>.

There is also \u02cf 'ˏ' mᵢˏⱼˏₖ and \u201A '‚' mᵢ‚ⱼ‚ₖ (vs '⸒' mᵢ⸒ⱼ⸒ₖ using \u2e12) either is more comma-like and available in many more fonts (these lists do not include recently released fonts):
~10 font families supporting \u2e12 (mᵢ⸒ⱼ⸒ₖ)
~100 font families supporting \u201a (mᵢ‚ⱼ‚ₖ)
~40 font families supporting \u02cf (mᵢˏⱼˏₖ)

IBM Plex Mono has \u201a \u02cf, does not have \u2e12
FiraMono, Roboto Mono, Hasklig have \u201a, do not have \u02cf \u2e12

Given the lesser availability of \u2e12, one of the alternatives is preferable.

Was this page helpful?
0 / 5 - 0 ratings