I keep copy-pasting code for printing stuff like the digits in ℝ²
. It usually goes like
const _SUPERSCRIPT_DIGITS = ['⁰', '¹', '²', '³', '⁴', '⁵', '⁶', '⁷', '⁸', '⁹']
function print_unicode_superscript(io::IO, k::Integer)
@argcheck k > 0
if k < 10
print(io, _SUPERSCRIPT_DIGITS[k + 1])
else
for d in digits(l)
print(io, _SUPERSCRIPT_DIGITS[d + 1])
end
end
end
The question is: I could not find a package that does this, wanted to check before packaging it up myself. Of course it could be extended a bit (subscripts, print to strings).