Not converting Latex Code to pdf
For example if I want to convert following code to a pdf `# Solution
A good choice is $k=2n$. This means that an array with twice the size of the original array is created, if the original array is full. To show that this choice has constant amortized costs for the insertion at the back, we do an amortized analysis. For that we define a potential function, which assigns a value to every array state (This value can bee interpreted as "account balance").
Quick reminder: in the amortized analysis, the potential function $\Phi_i$ is defined as potential after the i-th operation. The amortized cost of the i-th operation is defined by $a_i:=t_i+\Phi_i-\Phi_{i-1}$.
By this definition, the following holds for a series of mmm operations:
$$ \sum_{i=1}^{m} a_i = \sum_{i=1}^{m} (t_i + \Phi_i - \Phi_{i-1}) = \left( \sum_{i=1}^m t_i \right) + \Phi_m - \Phi_0 $$`
It doesn't convert the latex snippets into a correct formula.
How to convert it correctly?
Refering to the issue#21, you can add the following script in your .md file. I have tested and it works out!
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: {inlineMath: [['$', '$']]}, messageStyle: "none" });
</script>
Note that there is a potential problem that some LaTeX code can be converted by this extension and bring in some mistakes, please refer to KeTeX issue#1942 Take this as an example:
$$
L = \underbrace{ \frac{1}{N} \sum_i L_i }_\text{data loss} +
\underbrace{ \lambda R(W) }_\text{regularization loss}
$$
For the markdown-pdf extension, this will be converted into the below where <em> is inserted
<p>$$
L = \underbrace{ \frac{1}{N} \sum_i L_i }<em>\text{data loss} +
\underbrace{ \lambda R(W) }<em>\text{regularization loss}
$$ </p>
In this case, my clumsy solution is to add escape character \ before where errors occur,
$$
L = \underbrace{ \frac{1}{N} \sum_i L_i }\_\text{data loss} +
\underbrace{ \lambda R(W) }\_\text{regularization loss}
$$
And now latex expression can be rendered and converted successfully.😊
Something like \begin{align} should be modified to \begin{aligned}, since KaTeX doesn't support align but aligned
I'm still having this issue. The dirty solution that @Harrypotterrrr shared helps to render correctly, but it's quite time consuming to find the errors and fix them. Any clue on why sometimes the html converter inserts the <em> elements?