drbunsen - 1 year ago 88

LaTeX Question

I've spent a considerable about of time trying to figure out how I can take a markdown file, which contains TeX math and convert it into an ePub file where the math is rendered properly.

For example:

`This is a markdown file. Here is a [link](www.example.com).`

Here is some inline math: $\sigma_{i=1}^n \frac{\mu}{100}$

Here is an equation:

$$ y = mx + b $$

How can I convert a markdown file with the above text into an ePub file?

I've experimented with different methods of conversion using Pandoc; however, I still can not find a solution which renders the math even 50% correct.

Can anyone provide any help as to how I can do this?

I've tried this solution as well as other Pandoc option without success. Thanks in advance for the help.

Answer Source

Pandoc has an EPUB3 writer. It renders latex math into MathML, which EPUB3 readers are supposed to support (but unfortunately still few do). Use `pandoc -t epub3`

to force EPUB3 output, as opposed to EPUB2 which is the default.

Of course, this isn't much help if you want EPUB2 output or target readers that don't support MathML. Then you could try using the `--webtex`

option, which will use a web service to convert the TeX to an image.