Closed harisont closed 6 years ago
Note that \over
isn't handled by the texmath library, which pandoc
uses for math conversion. Use the more proper LaTeX \frac
instead:
$\frac{-a \pm \sqrt{b^2 - 4ac}}{2a}$
. Let us know if this doesn't
give you better results.
Arianna Masciolini notifications@github.com writes:
When I convert a markdown file containing any math formula in TeX, such as
$-b \pm \sqrt{b^2 - 4ac} \over 2a$
, to epub, both the rendered formula and-b \pm \sqrt{b^2 - 4ac} \over 2a
will be visible in the epub output (tried many readers). Using pandoc 2.1.3-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/jgm/pandoc/issues/4555
Same thing: both the (correctly) rendered formula and the LaTeX markup are visible in the resulting .epub file, no matter what's inside the $s.
Are you targeting epub3 or epub2? (epub == epub3 in recent pandoc)
Arianna Masciolini notifications@github.com writes:
Same thing: both the (correctly) rendered formula and the LaTeX markup are visible in the resulting .epub file, no matter what's inside the $s.
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/jgm/pandoc/issues/4555#issuecomment-381734031
I've tried both, same issue. Something similar happens with all pictures' alt text: the image is displayed perfectly, but the alt text is visible, too (that isn't very annoying, though, while on the other hand the LaTeX issue makes formulas a bit confusing).
Arianna Masciolini notifications@github.com writes:
I've tried both, same issue.
Strange. I've never noticed any problem in iBooks with epub3. With epub2, there is no math support in any reader unless you use --webtex or something to generate images. I haven't tried many other epub readers. What readers are you using? Does this happen for all formulas, or only some?
Something similar happens with all pictures' alt text: the image is displayed perfectly, but the alt text is visible, too (that isn't very annoying, though, while on the other hand the LaTeX issue makes formulas a bit confusing).
If you have an image alone in a paragraph, it will be treated
as a figure with the alt text as caption -- perhaps that's what you're
seeing here? You can disable this: -f markdown-implicit_figures
.
With epub2, there is no math support in any reader unless you use --webtex or something to generate images.
Yeah I was using the --webtext
option for epub2.
What readers are you using?
The target e-readers are Pocketbooks, but as I thought it could be a problem with their software I've tried the Kobo android app and the Calibre epub reader. The output is the same.
Does this happen for all formulas, or only some?
All formulas.
If you have an image alone in a paragraph, it will be treated as a figure with the alt text as caption -- perhaps that's what you're seeing here? You can disable this:
-f markdown-implicit_figures
.
Thanks for the tip, didn't know it. I'll try this.
I cannot reproduce this with the calibre ebook-viewer:
echo '$\sqrt{b^2 - 4ac}$' | pandoc -o test.epub --webtex
Does that not work for you? If not, can you give a specific command and possibly produced epub file?
Cool, if I use --webtex and target epub3 it works (in calibre), so I guess that's a solution and the pocketbook software is acting weird for some other reason. Thank you very much anyway, you've been both really kind and pandoc is an amazing software.
When I convert a markdown file containing any math formula in TeX, such as
$-b \pm \sqrt{b^2 - 4ac} \over 2a$
, to epub, both the rendered formula and-b \pm \sqrt{b^2 - 4ac} \over 2a
will be visible in the epub output (tried many readers). Using pandoc 2.1.3