# Python and greek indices

+1 vote

Dear all, I need to convert a Cadabra tensor expression in a python string. I am using the str(expression) command but it transforms greek indices in blank spaces. How can I solve the problem (I need both greek and latin indices)?
Thanks,
Mattia

Do you really need the Python form, or is the Cadabra input form perhaps better? The Python form gives greek indices in the form of Unicode characters, which the Cadabra notebook does not print because the LaTeX backend does not handle them correctly. But you can do

ex:=\alpha;
ex.input_form();


which will produce

\alpha


You can feed that back into Cadabra, e.g.

ex2=Ex("2 * "+ex.input_form());


which prints $2\alpha$.