-
Notifications
You must be signed in to change notification settings - Fork 571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken latex equations on convert #404
Comments
Ok there's something weird happening here. The issue has to do with the way that you broke lines in the middle of the second equation. So, if all you care about is that this particular code doesn't work then don't use $$
b_{l_1,l_2,l_3}^{\phi\phi\omega} = -8\, l_1\times l_2 \,l_1\cdot l_2 \int_0^{\chi_*} d\chi \frac{W(\chi,\chi_*)^2}{\chi^2} \int_0^{\chi}d\chi' \frac{W(\chi',\chi)W(\chi',\chi_*)}{{\chi'}^2} \left[
P_\psi\left(\frac{l_1}{\chi},z(\chi)\right) P_\Psi\left(\frac{l_2}{\chi'},z(\chi')\right)
- (l_1\leftrightarrow l_2)
\right]
$$ instead, don't break the line there. $$
b_{l_1,l_2,l_3}^{\phi\phi\omega} = -8\, l_1\times l_2 \,l_1\cdot l_2 \int_0^{\chi_*} d\chi \frac{W(\chi,\chi_*)^2}{\chi^2} \int_0^{\chi}d\chi' \frac{W(\chi',\chi)W(\chi',\chi_*)}{{\chi'}^2} \left[
P_\psi\left(\frac{l_1}{\chi},z(\chi)\right) P_\Psi\left(\frac{l_2}{\chi'},z(\chi')\right) - (l_1\leftrightarrow l_2) \right]
$$ But this illustrates that there's a bug in our parser. Somehow this is tricking our parser into thinking that some of the subscript commands indicated by an underscore ( |
Upon further investigation it seems to be entirely because of the list. So $$
b_{l_1,l_2,l_3}^{\phi\phi\omega} = -8\, l_1\times l_2 \,l_1\cdot l_2 \int_0^{\chi_*} d\chi \frac{W(\chi,\chi_*)^2}{\chi^2} \int_0^{\chi}d\chi' \frac{W(\chi',\chi)W(\chi',\chi_*)}{{\chi'}^2} \left[
P_\psi\left(\frac{l_1}{\chi},z(\chi)\right) P_\Psi\left(\frac{l_2}{\chi'},z(\chi')\right) -
(l_1\leftrightarrow l_2)
\right]
$$ should work as well. So it seems that what is wreaking havoc is that the markdown list parsing code is getting a little trigger happy and needs to be silenced inside of a LaTeX block. I would have thought that this was showing up in conversion because its a pandoc thing. @Carreau is that something we handle internally or is this a pandoc bug? |
Another problem with the parser: Using \begin{equation*} works in the notebook, but it is rendered as plain text in the html output. |
This has nothing to do with pandoc. I've found that a simple
The block parser is detecting that equal sign (or plus, minus, asterisk, etc.) as another Markdown block, that's internal to the mistune library, but that's not a mistune bug, as it doesn't render math blocks. Therefore, the nbconvert inline parser doesn't even "see" the whole block, it doesn't know that such a block has an end. The starting I'm going to make a pull request keeping the mistune library to at least fix this issue. However, I'm quite sure its rendering still won't behave like the Jupyter Notebook for any valid input. A better but hard solution would be either to translate to Python the Markdown rendering engine found in the Jupyter Notebook code (written in JavaScript AFAIK), or to use it directly as is (requiring some JavaScript interpreter). |
Mistune is already meant to be a close equivalent to marked, the JS markdown parser we use. |
Some latex code works fine in Jupyter notebook, but is not compiled correctly on export. e.g.
In the notebook it looks like this:
After HTML export it looks like this:
The text was updated successfully, but these errors were encountered: