Latex 无法在 Jupyter Notebook 上正确呈现

Latex not rendering correctly on Jupyter Notebook

我在使用 Jupyter 笔记本上的 Latex 时遇到一些问题。

每当我尝试使用 \begin{} .. \end{} 形式的 Latex expressiosn 时,代码都无法正确呈现。

当我使用内联表达式时,例如 $this 中的 $whatever,确实有效。

我已经尝试在代码单元格和 markdown 单元格中使用神奇的 %%latex。

这里有一个例子>

我看到很多人对此有疑问,但没有具体的解决方案。有任何想法吗??提前致谢。

编辑添加代码

在带有 %%latex 魔法的代码单元上

%%latex
\begin{tabular}{ | c | c   c   c | } \hline
        $k$ &   $x_1^k$  &   $x_2^k$  &    $x_3^k$   \
         \hline
         0 & -0.30000000 & 0.60000000 &  0.70000000  \
         1 &  0.47102965 & 0.04883157 & -0.53345964  \
         2 &  0.49988691 & 0.00228830 & -0.52246185  \
         3 &  0.49999976 & 0.00005380 & -0.52365600  \
         4 &  0.50000000 & 0.00000307 & -0.52359743  \
         5 &  0.50000000 & 0.00000007 & -0.52359885  \
         6 &  0.50000000 & 0.00000000 & -0.52359877  \
         7 &  0.50000000 & 0.00000000 & -0.52359878  \
         \hline
\end{tabular}

在没有魔法的降价单元格上

\begin{itemize}
\item Hello
\end{itemize}

但是下面的代码正确地呈现为矩阵,所以好像表格或分项被破坏了?

$$
\begin{pmatrix}
Var[X_1] & Cov[X_1,X_2] \
Cov[X_1,X_2] & Var[X_2].
\end{pmatrix}
$$

检查这个 :

Jupyter builds on MathJax and cite "MathJax doesn't implement tabular". The link also shows the recommended array environment as tabular replacement.

我建议使用Markdown Cells