TMorville TMorville - 11 months ago 112
Markdown Question

Pandocs: Md to pdf, support of html-style colors?

I'm trying to convert a .md to pdf that contains both html-style colors:

<span style="color:#3297A5">**Like this**</span>


and math:

$$
J(\theta) = \frac{1}{2m} [\sum_{i=1}^{m}(h_\theta(x^{(i)})-y^{(i)})^2 + \
lambda\sum_{j=1}^{n}(\theta_j^2)].
$$


using

pandoc -s -o test.pdf test.md


outputs formatting and math fine, but no colors. Using this online md to
pdf tool http://www.markdowntopdf.com/ i get the colors right, but not
the math, which indicates that md to pdf conversion of html-style colors is possible?

Answer Source

If you want to use CSS to change colors, you'll have to use wkhtmltopdf instead of LaTeX, e.g.

$ pandoc input.md --mathjax -t html5 -o output.pdf

(or try --mathml instead of --mathjax, see the pandoc manual)

Alternatively, you can use a LaTeX template and do layouting there. For more info, see http://pandoc.org/MANUAL.html#creating-a-pdf

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download