在Jupyter中编写\ alpha和\ beta的问题

时间:2019-03-15 11:29:21

标签: python jupyter-notebook latex tex

我正在jupyter内使用Getdist绘制曲线。对于标记参数,我有一个问题。 我写了\zeta\chi\gamma\Omega\omega,但它们没有问题,它们的符号形状也没有问题,但是我想写\beta\alpha时遇到一些错误

这是错误太长的一部分

ValueError: 
$lpha$
^
Expected end of text (at char 0), (line:1, col:1)

这是相关代码的一部分:

g.triangle_plot([samples0],['H_0','\Omega_D','b','aa','\alpha','M','t']

我真的不明白这个问题,我很困惑。

1 个答案:

答案 0 :(得分:2)

这是因为AggregateException是ascii字符7 ascii table的字符串文字,就像'\a'是制表符而'\t'是换行符一样。

我们可以使用内置函数'\n'进行检查,该函数返回所提供字符-doc

的相应ASCII表索引
ord()

另一方面,>>> ord('\a') 7 >>> ord('\n') 10 >>> ord('\t') 9 与任何字符都不对应。

'\o'

要解决此问题,只需在这样的字符串之前加>>> ord('\o') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: ord() expected a character, but string of length 2 found (如r一样

raw string