(Julia 1.6)
I deal with equations from publications and the variables there have lots of subscripts and superscripts. They cannot be represented as Julia variable names and I would prefer not to compromise. For example, I might want something like this:
using LaTeXStrings,Latexify, Symbolics
@variables x_plus # this is a variable
# this is what I would like the variable to be written as
repr_map = Dict(x_plus => L"x^{+}_{A,\alpha_{1}}")
Now I want to do something like
@latexify x_plus + x_plus^2 + factorial(x_plus)
# and also give the macro my `repr_map`, tell it somehow that I want factorial written as !...
and get x^{+}_{A,\alpha_{1}} + {(x^{+}_{A,\alpha_{1}})}^2 + (x^{+}_{A,\alpha_{1}})!.
Is there a way to do this? One thing I tried was modifying Latexify.jl (this file: Latexify.jl/…/function2latex.jl) to add my own symbols. This doesn’t really work for everything and of course having to modify the library isn’t a good solution. Is there a way to add “custom rules” to Latexify?
If there is no way currently, would such an idea be consistent with what Latexify.jl is trying to do? If so, I would be willing to help implement it.
The problem with the “latex rendering error” in my last post can be partially solved by adding even more brackets to the variable name (symbol). Of course, this does not help with things like factorial.
@variables var"{x^{+}_{A,\alpha_{1}}}"
Note that in the output, the second-order-subscript “1” is not represented properly because Latexify escapes the underscore. I don’t think there is a way to mitigate this right now, short of editing Latexify.jl sources.