简体   繁体   中英

Latex not rendering correctly on Jupyter Notebook

I am having some trouble with Latex on my Jupyter Notebook.

Whenever I try to use Latex expressiosn of the form \begin{}.. \end{} the code is not correctly rendered.

When I use inline expressions, like the $ whatever inside $ this, DOES work.

I have tried with the magic %%latex on code cells, as well as in markdown cells.

Here an example of what happens>

在此处输入图像描述

I read that many people have problems with this, but not concrete solution. Any ideas?? Thanks a lot in advance.

EDIT ADD CODE

On a code cell with the %%latex magic

%%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}

On a markdown cell without the magic

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

But the following code renders as a matrix correctly , so it's like tabular or itemize are broken?

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

Check this answer :

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

I suggest to use Markdown Cells .

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM