在Ipython输出中编写Latex

时间:2016-12-28 15:48:26

标签: python ipython ipython-notebook

考虑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

1 个答案:

答案 0 :(得分:0)

您可以通过将完整的乳胶字符串传递给.contentcontainer { padding-left: 15px; padding-right: 15px; } 构造函数来渲染它:

Latex