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
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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.