Creating symbols from strings in Symbolics package

Firstly I am talking about Num and Real symbols in the Julia Symbols package. If I am talking about coding symbols in general I know I can create then from a string by

X2 = Symbol("x^2")
println(X2)
x^2

but in the Symbolics package you create a symbolic symbol with @variables X2::Num or @variables X2::Real. Is there anyway to create a symbolic symbol from a text string to get the same printing behavior as demonstrated above. For example I would like a symbolic symbol g12 to print as \bs{e}_1\cdot\bs{e}_2 so when I print g12 using a latex print function I get \boldsymbol{e}_1\cdot\boldsymbol{e}_2.

julia> using Symbolics

julia> x = Symbol("x")   # Create a symbol from a string
:x                       
                         
julia> x, = @variables $x # interpolate the symbol into a variable expression to create a Symbolics variable
1-element Vector{Num}:   
 x                       
                         
julia> expr = x^2    # A symbolic expression    
x^2                      

julia> using Latexify
                         
julia> latexify(expr)    
L"\begin{equation}       
x^{2}                    
\end{equation}           
"                        
                         
1 Like

Thank you, thank you, thank you! I have been doing python coding for over 25 years and started Julia last week. It will take a while to get used to the new paradigm. Now I will proselytize some graphics software with an interface for Julia -

https://asymptote.sourceforge.io/

https://github.com/sswatson/AsyPlots.jl