# General subscripts in symbols?

**URL:** <https://discourse.julialang.org/t/general-subscripts-in-symbols/73633>\
**Category:** General Usage\
**Tags:** unicode\
**Created:** [December 26, 2021, 3:07am UTC](https://discourse.julialang.org/t/general-subscripts-in-symbols/73633 "2021-12-26T03:07:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![RobertN](https://avatars.discourse-cdn.com/v4/letter/r/f0a364/32.png) [@RobertN](https://discourse.julialang.org/u/RobertN)\
**Post date:** [December 26, 2021, 3:07am UTC](https://discourse.julialang.org/t/general-subscripts-in-symbols/73633/1 "2021-12-26T03:07:22Z")

</div>

I was just playing around with subscripts in symbol names:

```julia
Δx₂ = 123

```

It’s cool that you can do this, but I’m restricted to Unicode it seems.

I’m curious, is there a way to write a general subscript? Like the way you can in HTML:

```nohighlight
foo<sub>123</sub>

```

Some kind of delimiters in the symbol name, which would disappear when rendered in an editor?

I’m new to Julia and not saying it _should_ be this way. Just wondering.

---

<div class="post-metadata">

**Author:** ![c42f](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/c42f/32/52842_2.png) [@c42f](https://discourse.julialang.org/u/c42f)\
**Post date:** [December 26, 2021, 4:01am UTC](https://discourse.julialang.org/t/general-subscripts-in-symbols/73633/2 "2021-12-26T04:01:08Z")

</div>

Julia source code is encoded in UTF-8, so only Unicode characters are supported. There’s no markup language layer on top of the raw unicode characters. If we had this, most text editors wouldn’t be able to render Julia source code!

Most letters and numbers are available as unicode subscript characters, so in this particular case you can just write `foo₁₂₃`.

This needs to be typed as `foo\_1<TAB>\_2<TAB>\_3<TAB>` though, which is quite inconvenient.

Actually with this in mind it would be a cool extension to the Julia REPL to allow a tab completion of this identifier as the latex-like `foo\_{123}<TAB>`. (If this was in the main REPL, the various editor plugins would also probably support it fairly quickly.)

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [December 26, 2021, 4:05am UTC](https://discourse.julialang.org/t/general-subscripts-in-symbols/73633/3 "2021-12-26T04:05:47Z")

</div>

Some people want to propose a change to unicode for arbitrary sub/superscripts but I haven’t seen progress on it.

[https://github.com/stevengj/subsuper-proposal](https://github.com/stevengj/subsuper-proposal)

---

<div class="post-metadata">

**Author:** ![c42f](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/c42f/32/52842_2.png) [@c42f](https://discourse.julialang.org/u/c42f)\
**Post date:** [December 26, 2021, 4:18am UTC](https://discourse.julialang.org/t/general-subscripts-in-symbols/73633/4 "2021-12-26T04:18:18Z")

</div>

> [@c42f](#):
>
> Actually with this in mind it would be a cool extension to the Julia REPL to allow a tab completion of this identifier as the latex-like `foo\_{123}<TAB>` . (If this was in the main REPL, the various editor plugins would also probably support it fairly quickly.)

Haha, I started looking at implementing this, but it turns out it’s already done and available in Julia 1.6!

> <https://github.com/JuliaLang/julia/pull/38649>
>
> Closes #38644: Tab completion now supports runs of consecutive sub/superscript c…haracters, e.g. \`\\^(3)\` tab-completes to \`⁽³⁾\`.
> 
> The REPL help also reflects this, e.g.
> \`\`\`
> help?\> ᵞ₁₂₃¹²³α
> "ᵞ₁₂₃¹²³α" can be typed by \\^gamma\<tab\>\\\_123\<tab\>\\^123\<tab\>\\alpha\<tab\>
> \`\`\`

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [December 26, 2021, 5:57am UTC](https://discourse.julialang.org/t/general-subscripts-in-symbols/73633/5 "2021-12-26T05:57:00Z")

</div>

exactly:

```julia
help?> foo₁₂₃
"foo₁₂₃" can be typed by foo\_123<tab>

```
