fletcher / MultiMarkdown-4

This project is now deprecated. Please use MultiMarkdown-6 instead!
https://github.com/fletcher/MultiMarkdown-5
Other
306 stars 59 forks source link

Mathjax and superscript notations collide #96

Closed rothos closed 9 years ago

rothos commented 9 years ago

Specifying an equation like

\begin{equation}
    E = m c^2
\end{equation}

is valid Mathjax, but MultiMarkdown converts it to

\begin{equation}
    E = m c<sup>2</sup>
\end{equation}

which breaks the formatting of the equation.

Is there a way to disable the super-/subscript conversion in MultiMarkdown? Is disabling particular features possible?

mn4367 commented 9 years ago

You have to use control sequences to mark formulas:

A formula \\( E = m c^2 \\) inside text.

A formula $E = m c^2$ inside text.

A separate formula:

\\[
  \begin{equation}
    E = m c^2
  \end{equation}
\\]

A separate formula:

$$\begin{equation}
    E = m c^2
\end{equation}$$

Please note that when using $ there must be no space after the opening $ and no space before the closing $. Everything between the control sequences will be left untouched by MultiMarkdown.

If you don't use the control sequences your input is treated as normal text and thus the conversion to super-/subscript is correct.

The result is:

<p>A formula <span class="math">\( E = m c^2 \)</span> inside text.</p>

<p>A formula <span class="math">\(E = m c^2\)</span> inside text.</p>

<p>A separate formula:</p>

<p><span class="math">\[
  \begin{equation}
    E = m c^2
  \end{equation}
\]</span></p>

<p>A separate formula:</p>

<p><span class="math">\[\begin{equation}
    E = m c^2
\end{equation}\]</span></p>
fletcher commented 9 years ago

Explanation by @mn4367 is correct. If you demarcate the text as MMD Math, the other rules are not applied. Otherwise, it is (correctly) treated as regular text to be processed by MMD.