Suggestion about \ and unicode characters in typst

I’m kinda inspired by the Julia and Lean language servers as they exhibit the following behavior:

Let’s say I type “\epsilon” what will happen is a small menu will open which lets me select the real unicode character for ϵ.

It would be nice in typst that if one types the thing to be rendered with a \ for it to be replaced by the corresponding unicode character.

The main benefit one derives from this is to make typst more readable by replacing long words like epsilon with unicode characters ϵ.
As
$ ∫ ∇ ⋅ (γ∇ u ) d Ω $
is better readable than:
$ integral nabla dot (gamma nabla u) d Omega $
yet both is valid typst

My suggestion is not to include that to typst itself. Just implement that into the editor and language server.

Please consider!

4 Likes

Backslashes are ugly. They hurt our eyes.

For prettier display, you can use this extension:

which automatically replaces symbol code with the actual symbol without affecting the original file.

This topic may be moved to Questions .

I strongly agree that unicode is more readable and in general a superior way of writing source code.

My personal solution for that is to remap some of my keyboard keys to unicode characters and to use snippet engines that automatically substitute e.g. “iff” in math mode with “⟺”.

I really like the idea, to have the option for letting things be substituted by the language server!

2 Likes

In the proposal of OP backslashes would only be there temporarily in the file, so the ugliness is bounded. Also, if this is implemented, it would be easy to implement an option for everyone to configure the prefix themselves.

The extension you propose is just a partial solution that makes the source code in VSCode while the extension is active a bit more readable and is insufficient/worse than a real substitution by Unicode symbols.

It’s a suggestion, but it’s not Meta (i.e. regarding the forum) so I moved it to General.

This would be not a compiler feature but of the editor (VS Code, or the webapp), so a feature request could be made (if it doesn’t exist yet).

1 Like