I’d like to write a function f(n::Int)::String such that f(1) = "x₁", f(2) = "x₂" and so on (assume 1<=n<=9 for simplicity). Since
julia> 'x' * '\u2081'
"x₁"
Let n=3; the syntax 'x' * '\u' * string(n + 2080) is invalid: ERROR: syntax: invalid escape sequence. The backslash can be escaped with “raw”, but how can i get the subscript back?
Don’t use a monospaced font or use a text-rendering engine? Julia has no control over text-rendering of Unicode strings in a terminal.
Except for using the LaTeXStrings?
LaTeXStrings doesn’t actually do any text rendering either. It relys on you having an environtment (e.g. Jupyter) that supports LaTeX rendering. (In Jupyter, you could also use HTML subscripts with e.g. Docs.HTML("<sub>123</sub>")).)