[IPython-dev] ipython html notebook: markdown in math mode and backslashes

Aron Ahmadia aron at ahmadia.net
Thu Aug 23 09:26:21 EDT 2012


Dear ipython developers,

Apologies for the imprecise language, I don't have a perfect feel for the
various ipython components yet, so I'll use general terms to describe the
issue at hand.

It is convenient MarkDown+LaTeX notation to write a multiline equation with
something like this:

$$
\begin{align*}
u_t(x,t) & = f(x,t) \\
u(x,0) & = u_0
\end{align*}
$$

We use the $$ to deliberately enter "math mode", telling the markdown
editor that it is no longer responsible for rendering anything until the
next $$.  MathJaX takes over here, and is responsible for properly
formatting and rendering the math in equation-rendering mode.

Unfortunately, it looks like the Markdown parser being used in the notebook
is unaware of equation mode, and is still trying to "munch" the backslashes
before they get handed to MathJaX for rendering, forcing me to markup my
equations like this:

\begin{align*}
u_t(x,t) & = f(x,t) \\\\
u(x,0) & = u_0
\end{align*}

This seems to be a general problem with the ipython notebook markdown
renderer.  I've noticed that I can slip other pieces of Markdown formatting
into an equation (regardless of whether I have specified math mode or
entered an equation block) and totally break MathJax's rendering.

Here's my proposal:

Modify/patch/preprocess the Markdown code being used by ipython to render
the web pages so that any text bracketed by $$ is passed completely raw to
MathJaX.

I think this will fix the issues I'm seeing with backslashes as well as
bring the Markdown+LaTeX notation into consistency with that used by other
editors of this nature such as StackExchange and gitit.

Cheers,
Aron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20120823/8f7c3150/attachment.html>


More information about the IPython-dev mailing list