[英]Writing Latex in Ipython output
考慮一下IPython筆記本中的以下幾行:
B=1.0e5 # in Gauss
fce = 1.80e6 * B
print "Electron gyrofrequency $f_{ce}$= %0.5e " %(fce)
我無法獲得$ f_ {ce} $以乳膠形式打印。 我也嘗試過:
from IPython.display import display, Math, Latex
display ("Electron gyrofrequency" + Math(r'f_{ce}') + "= %0.5e " %(fce))
我收到一個錯誤:
TypeError: cannot concatenate 'str' and 'Math' objects
您可以通過將完整的乳膠字符串傳遞給Latex
構造函數來呈現它:
from IPython.display import Latex
B=1.0e5 # in Gauss
fce = 1.80e6 * B
Latex("Electron gyrofrequency $f_{ce}$= %0.5e " % fce)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.