Printing latex
I am using sage and would like to implement a function that prints a variable in latex, so I can copy and paste it directly into my latex file. However I am unsure how to do this. This is what I have attempted:
def printlatex(a):
return '$', latex(a), '$'
a = 1*2
printlatex(a)
This returns the tuple ('$', 2, '$')
, which I don't want.
How would I implement the function so it returns $2$
A plus instead of the comma...