Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

markdown latex driving me crazy with hugo on github

I use the even theme.

$$
L=\sum_{(u,v)\in D} \log {\exp(-d(u,v))}
$$

and

$$
-\log {\sum_{v' \in N(u)} \exp(-d(u,v'))}
$$

works but when I combine the two,

$$
L=\sum_{(u,v)\in D} \log {\exp(-d(u,v))}-\log {\sum_{v' \in N(u)} \exp(-d(u,v'))}
$$

It is not outputted as latex. Debugging this thing is also time consuming.

like image 471
ztyh Avatar asked Dec 03 '18 05:12

ztyh


1 Answers

Many markdown processors use the underscore (_) to indicate italics (one at the beginning and one at the end of the text to be italicized). So when your math contains two underscores, Markdown removes them and inserts <em>...</em> tags (or something equivalent to that) before sending the page to the browser. MathJax doesn't process math that contains HTML tags, so the resulting (modified) math is not typeset.

The usual solution is to use a backslash to prevent the underscore from being processed by Markdown, so use \_ in place of _ in your math. You may also need to double some backslashes (e.g., \\ may need to be entered as \\\\ in a Markdown document).

See the MathJax documentation on LaTeX in HTML documents for more details (look for the paragraphs on Markdown).

like image 160
Davide Cervone Avatar answered Nov 15 '22 07:11

Davide Cervone