Recently I'm trying to create an ebook. I tried to write the words in Markdown and convert it to epub using Pandoc. There is this LaTex thing got me in trouble.
I have this line: <A,B,C,D>, which should be written in LaTex, and I used
$\left\langle A,B,C,D \right\rangle$
in Markdown. This formula displays well in Markdown editor and the html converted by Pandoc. But when I convert this file to epub using Pandoc, the angle brackets just went missing. The rest of the fomula was displaying very well, only the brackets were missing.
Does anyone know how to do this? Thank you.
From this answer:
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.
Also note that generally speaking, when converting Math to HTML, pandoc embeds MathJax or similar JavaScript libraries to render the math. However, some simple commands like \left\langle
are simply converted to the corresponding unicode chars, also for EPUB output – ⟨A,B,C,D⟩
in your example. So most probably the font used by your EPUB reader hasn't a glyph for those characters. (I quickly tested your snippet and it works in Mac OS X's iBooks reader but not in Calibre...)
See also Creating an ebook with pandoc and pandoc manual: Creating EPUBs with pandoc.
TL;DR: depending on which EPUB readers you target, either use --webtex
or -t epub3
.