Search code examples
latexgithub-flavored-markdownpelican

how can I align my latex equations within Github flavored markdown?


I have put together a simple blog using the Pelican package in Python.

I have hosted the site on Github.

For some reason, the markdown will not seem to cooperate with aligning a sequence of equations:

$$
\begin{align*}
\sum_{i = 1}^{n} | (f + g )(x_i) - (f + g)(x_{i-1}) | &= \sum_{i = 1}^{n} | \{ f(x_i) + g(x_i) \} - \{ f(x_{i - 1} + g(x_{i-1}) \} |
\\  &\leq \sum_{i = 1}^{n} | f(x_i) - f(x_{i - 1} | + \sum_{i = 1}^{n} | g(x_i) - g(x_{i - 1})|
\\  &\leq  V(f, P) + V(g, P)
\end{align*}
$$ 

I don't understand how to line up my equations by the = and <= signs, like is commonly done in Latex. Is this a limitation with github flavored markdown, or something to do with MathJax?

Basically, my question is, how can I align my equations using Markdown, since Latex obviously doesn't work?


Solution

  • Notice how the text that is actually being rendered is in italics? Poke around in your page's source code and you will discover that this is because the asterisks in your \begin{align*} environment definition are actually being interpreted by the markdown engine and are therefore converted to <em> tags, which obviously LaTeX has no clue what to do with, so MathJax just begs off.

    The fix will be to escape the asterisks in your markdown, so that by the time it gets run through Pelican's markdown engine and the MathJax engine actually gets a crack at it (on the client's side), it is recognisable as LaTeX.