Reputation: 1366
Consider the following lines in a IPython notebook:
B=1.0e5 # in Gauss
fce = 1.80e6 * B
print "Electron gyrofrequency $f_{ce}$= %0.5e " %(fce)
I cannot get $f_{ce}$ to print in its latex form. I also tried:
from IPython.display import display, Math, Latex
display ("Electron gyrofrequency" + Math(r'f_{ce}') + "= %0.5e " %(fce))
I got an error:
TypeError: cannot concatenate 'str' and 'Math' objects
Upvotes: 1
Views: 3292
Reputation: 31349
You can render the full latex string by passing it to the Latex
constructor:
from IPython.display import Latex
B=1.0e5 # in Gauss
fce = 1.80e6 * B
Latex("Electron gyrofrequency $f_{ce}$= %0.5e " % fce)
Upvotes: 1