4
votes

I installed VS Code today and created a very simple jupyter notebook which runs without any errors, but does not render the LaTex in VS Code even after installing the LaTex Workshop extension.

When I run the same notebook directly in jupyter, it renders fine.

This is the code from the markdown cell in question:

### This is another markdown cell with Latex

This equation defines eigenvalues and eigenvectors: $Mx = \lambda x$

another equation:
$\begin{align*}
(a+b)^2 = a^2+2ab+b^2
\end{align*}$

In jupyter, the cell looks like this:

enter image description here

In VS Code, the cell looks like this:

enter image description here

1
I have the exact same behavior and I have spent hours searching for a solution, as far as i know mathjax is what jupyter notebooks use to render this latex code. In my case this only happens when i'm offline (which is unfortunately most of the time), but as soon as vscode has internet access I rerun the cell and it renders it perfectly. Even after disconnect from internet it still renders it perfect (even new latex code in other cells). I hope some has an offline solution for this.Jorge Morgado
That makes sense because I'm in a very locked down environment. Probably getting blocked from something it needs for rendering properly.Michael Szczepaniak
I check again and it stop working again when offline. I leave in an answer below the reason of this.Jorge Morgado
As a general Latex render engine use Mathover.Xaqron
Hi, I'm happy to say that this problem is fixed now. See edit on answer.Jorge Morgado

1 Answers

3
votes

I found why that happens. The answer is that the Python extension of vscode (which is the one who allows to open jupyter notebooks inside of it) currently does not support this feature offline. They even open an issue because of this.

EDIT [Jun 16th, 2021]

This problem was fixed in the last version of vscode and the jupyter extension.