-
Notifications
You must be signed in to change notification settings - Fork 572
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
Maths environments converted as markdown --> rendering issues #160
Comments
I don't see this problem when I convert it with master. Can you check what versions of nbconvert and mistune you have installed? |
The issue described above was under debian with vanilla python/jupyter. I have reproduced the same behaviour under windows with an anaconda distribution. I still hope that this is not a side effect of something I may have installed elsewhere... I took the precaution to disable nbextensions and renamed ~/.jupyter into something else before attempting again. I also observed that the conversion issue happens only if the markdown cell contains something before the equation. That is An equation with a "link" in it
\begin{equation}
[h*x](n)=z
\end{equation} produces an issue like I reported before, while a cell with the equation alone yields the correct conversion. Another example is A simple sum
\begin{equation}
a
+ b
+ c
\end{equation} which yields A simple sum
\begin{equation}
a</p>
<ul>
<li>b</li>
<li>c
\end{equation}</li>
</ul> |
Output of debug mode:
|
Aha, the 'something before' was the key. Now I can reproduce it. Mistune tries to match a series of block level rules, to which we add a rule for latex environments, which passes the contents through without parsing inline markup. However, in this case, the paragraph rule is matching the whole block, so our latex_environment rule never sees it. You can work around it by leaving a blank line before your
The paragraph rule has a series of clauses that will cause it to stop matching at other block-level elements, e.g. @lepture, would you be interested in making this more robustly extensible? I can spend some time working on it, if you like. |
@takluyver I am going to rewrite mistune with suggestions by http://lucumr.pocoo.org/2015/11/18/pythons-hidden-re-gems/ some days (that would be next year). Currently, I don't have much time working on it. If you could help me, I'd be happy to review it. |
@lepture Are you aware of pyparsing? The more regexp magic one needs, the more likely pyparsing would be more elegant, and maybe even faster. |
I have noticed the following with nbconvert 4.1.0:
The conversion via
jupyter nbconvert FILE.ipynb
leads to an html file with this excerptThe pair of subscripts have been converted to em tags, and of course MathJax then refuses to render the equation. A similar issue occurs with an equation like
where the notation at the beginning is interpreted as a link (and of course not rendered)
In the past, equations/align/etc (perhaps all environments) were not converted. It might certainly be a good idea to do so, but this causes this kind of problems. Also this happens only in the nbconvert path. The same equations are rendered correctly in the notebook.
The text was updated successfully, but these errors were encountered: