public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Maths in ebooks
@ 2015-01-15  8:59 Thomas Arildsen
       [not found] ` <dfcf2e4b-b377-4d48-be9f-de82088e7832-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Arildsen @ 2015-01-15  8:59 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


[-- Attachment #1.1: Type: text/plain, Size: 1668 bytes --]

I have been experimenting with including maths in ebooks (ultimately 
because I would like to be able to publish my research as ebooks instead of 
PDF which I think is suboptimal for tablets etc.) One approach that sort of 
works for me is converting from Markdown with LaTeX maths to ePub where I 
can make Pandoc turn the maths into MathML. My problem is just that the 
MathML looks quite horrible in comparison to what LaTeX can usually produce 
in PDF etc.
A fall-back solution for me could be to render the maths bitmapped and then 
include the images in the document. However, I recently figured out that 
ePub seems to support SVG as well and it is actually possible to turn LaTeX 
into SVG output (see e.g. http://dvisvg.sourceforge.net/ and 
http://svgkit.sourceforge.net/SVGLaTeX.html). So far I have succeeded in 
doing this quite manually, but I was wondering if it would be possible to 
make Pandoc able to automate this conversion of math formulae into SVG with 
subsequent inclusion of the SVG into the ePub? I have no experience in 
hacking Pandoc.
Best regards,

Thomas Arildsen

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/dfcf2e4b-b377-4d48-be9f-de82088e7832%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 2082 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Maths in ebooks
       [not found] ` <dfcf2e4b-b377-4d48-be9f-de82088e7832-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2015-01-15 17:51   ` Paulo Ney de Souza
       [not found]     ` <CAFVhNZPeDbtt+Tt3=8BYVX42XfFb=4RtaLGt29Ho-ik=QzeTSg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2015-01-15 20:30   ` John MacFarlane
  2015-01-16  2:11   ` Raniere Silva
  2 siblings, 1 reply; 18+ messages in thread
From: Paulo Ney de Souza @ 2015-01-15 17:51 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 5106 bytes --]

Well... it is not so simple ....

The first problem that arises is -- what is the "target ePub" -- specially
since you are talking about displaying it in a device, and in a way that is
better than PDF.

The kind of ePub produced by Pandoc is a sort of a "pure ePub" -- it
generates both ePub2 and ePub3 that passes validation with flying colors
but displays very poorly on the devices (iPad, Kobo, Nook, Google Play,
ADE, browser ePub display, converted to Kindle, etc ...). The main reasons
for that can be broken in two classes:

First is a CSS problem: Pandoc offers you a plain ePub and does not play
much with the CSS, while a LOT of what makes a good ePub relies on CSS.
This problem is resolvable, you just have to spend the time finding out
what is  the look you find the best and the target machine you want it for.

The second class of problems is much harder: Not all ePub elements are
supported by all manufacturers and programs and even then -- they make
their own choice on HOW to support it and their OWN interpretation on how
it should look like.

Ultimately every one of these ePub rendering engines use an HTML rendering
engine underneath, but manufacturers are not very open and forthcoming with
what rendering engine they are using for their reader -- very few release
that information and they change it all the time (now that rendering
engines are becoming a standard and a commodity). There are even reports
that a reader (Kobo) uses one rendering engine in one platform and another
elsewhere.

And up to now we have not even touched SVG ... and here the problem
iterates again... SVG is a standard (as MathML is) and as such manufactures
pick and choose which parts to use and support. It is fairly easy to make
an SVG for a circle that will not display on one or another rendering
engine.

For a look at the ePub3 Support Grid you can check:
http://epubtest.org/results/ and on http://epubtest.org/compare/ you can
see what pieces of the SVG standard are supported by each reader.

The problem is very similar to the one tackled by MathJax and KaTeX --
these are programs that stick their tongue out, feel the environment in the
user machine (browser, rendering engine, installed fonts, etc ...) and
prepare from sources the kind of HTML/MathML/CSS/Fonts it should be sent to
that reader.

We literally need to do the same for ePub, and start delivering the ePub
that is appropriate for one or another device...that will take some work!

Paulo Ney

PS.Just a remark - SVGLaTeX is a defunct project right now.







On Thu, Jan 15, 2015 at 2:59 AM, Thomas Arildsen <thomasarildsen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:

> I have been experimenting with including maths in ebooks (ultimately
> because I would like to be able to publish my research as ebooks instead of
> PDF which I think is suboptimal for tablets etc.) One approach that sort of
> works for me is converting from Markdown with LaTeX maths to ePub where I
> can make Pandoc turn the maths into MathML. My problem is just that the
> MathML looks quite horrible in comparison to what LaTeX can usually produce
> in PDF etc.
> A fall-back solution for me could be to render the maths bitmapped and
> then include the images in the document. However, I recently figured out
> that ePub seems to support SVG as well and it is actually possible to turn
> LaTeX into SVG output (see e.g. http://dvisvg.sourceforge.net/ and
> http://svgkit.sourceforge.net/SVGLaTeX.html). So far I have succeeded in
> doing this quite manually, but I was wondering if it would be possible to
> make Pandoc able to automate this conversion of math formulae into SVG with
> subsequent inclusion of the SVG into the ePub? I have no experience in
> hacking Pandoc.
> Best regards,
>
> Thomas Arildsen
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/dfcf2e4b-b377-4d48-be9f-de82088e7832%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/dfcf2e4b-b377-4d48-be9f-de82088e7832%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAFVhNZPeDbtt%2BTt3%3D8BYVX42XfFb%3D4RtaLGt29Ho-ik%3DQzeTSg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 6717 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Maths in ebooks
       [not found] ` <dfcf2e4b-b377-4d48-be9f-de82088e7832-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2015-01-15 17:51   ` Paulo Ney de Souza
@ 2015-01-15 20:30   ` John MacFarlane
       [not found]     ` <20150115203001.GA10846-nFAEphtLEs/fysO+viCLMa55KtNWUUjk@public.gmane.org>
  2015-01-16  2:11   ` Raniere Silva
  2 siblings, 1 reply; 18+ messages in thread
From: John MacFarlane @ 2015-01-15 20:30 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Seems to me it would not be hard to write a pandoc filter
that did this.  There's an example filter in the
pandocfilters repository that converts tikz images in
LaTeX to images.  Something like that could work here too,
only you'd match on 'Math' rather than 'RawBlock'.

https://github.com/jgm/pandocfilters/blob/master/examples/tikz.py

Filters can be written in Haskell or python (there are also
libraries to facilitate writing them in php and perl).


+++ Thomas Arildsen [Jan 15 15 00:59 ]:
>   I have been experimenting with including maths in ebooks (ultimately
>   because I would like to be able to publish my research as ebooks
>   instead of PDF which I think is suboptimal for tablets etc.) One
>   approach that sort of works for me is converting from Markdown with
>   LaTeX maths to ePub where I can make Pandoc turn the maths into MathML.
>   My problem is just that the MathML looks quite horrible in comparison
>   to what LaTeX can usually produce in PDF etc.
>   A fall-back solution for me could be to render the maths bitmapped and
>   then include the images in the document. However, I recently figured
>   out that ePub seems to support SVG as well and it is actually possible
>   to turn LaTeX into SVG output (see e.g. http://dvisvg.sourceforge.net/
>   and http://svgkit.sourceforge.net/SVGLaTeX.html). So far I have
>   succeeded in doing this quite manually, but I was wondering if it would
>   be possible to make Pandoc able to automate this conversion of math
>   formulae into SVG with subsequent inclusion of the SVG into the ePub? I
>   have no experience in hacking Pandoc.
>   Best regards,
>   Thomas Arildsen
>
>   --
>   You received this message because you are subscribed to the Google
>   Groups "pandoc-discuss" group.
>   To unsubscribe from this group and stop receiving emails from it, send
>   an email to [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>   To post to this group, send email to
>   [2]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>   To view this discussion on the web visit
>   [3]https://groups.google.com/d/msgid/pandoc-discuss/dfcf2e4b-b377-4d48-
>   be9f-de82088e7832%40googlegroups.com.
>   For more options, visit [4]https://groups.google.com/d/optout.
>
>References
>
>   1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>   2. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>   3. https://groups.google.com/d/msgid/pandoc-discuss/dfcf2e4b-b377-4d48-be9f-de82088e7832-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer
>   4. https://groups.google.com/d/optout


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Maths in ebooks
       [not found]     ` <20150115203001.GA10846-nFAEphtLEs/fysO+viCLMa55KtNWUUjk@public.gmane.org>
@ 2015-01-15 20:32       ` a
  2015-01-15 21:24         ` Thomas Arildsen
                           ` (2 more replies)
  2015-01-15 21:24       ` Thomas Arildsen
  1 sibling, 3 replies; 18+ messages in thread
From: a @ 2015-01-15 20:32 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

The simple pandoc epubs I generated and displayed on my old Hanvon              
Reader and the Geeksphone looked just fine.                                     
Even the math is ok. Sure I would prefer SVG math, but it was quite readable.   
For plain text I don't see why the "pure ePub" is a problem.   


On Thu, Jan 15, 2015 at 12:30:01PM -0800, John MacFarlane wrote:
> Seems to me it would not be hard to write a pandoc filter
> that did this.  There's an example filter in the
> pandocfilters repository that converts tikz images in
> LaTeX to images.  Something like that could work here too,
> only you'd match on 'Math' rather than 'RawBlock'.
> 
> https://github.com/jgm/pandocfilters/blob/master/examples/tikz.py
> 
> Filters can be written in Haskell or python (there are also
> libraries to facilitate writing them in php and perl).
> 
> 
> +++ Thomas Arildsen [Jan 15 15 00:59 ]:
> >  I have been experimenting with including maths in ebooks (ultimately
> >  because I would like to be able to publish my research as ebooks
> >  instead of PDF which I think is suboptimal for tablets etc.) One
> >  approach that sort of works for me is converting from Markdown with
> >  LaTeX maths to ePub where I can make Pandoc turn the maths into MathML.
> >  My problem is just that the MathML looks quite horrible in comparison
> >  to what LaTeX can usually produce in PDF etc.
> >  A fall-back solution for me could be to render the maths bitmapped and
> >  then include the images in the document. However, I recently figured
> >  out that ePub seems to support SVG as well and it is actually possible
> >  to turn LaTeX into SVG output (see e.g. http://dvisvg.sourceforge.net/
> >  and http://svgkit.sourceforge.net/SVGLaTeX.html). So far I have
> >  succeeded in doing this quite manually, but I was wondering if it would
> >  be possible to make Pandoc able to automate this conversion of math
> >  formulae into SVG with subsequent inclusion of the SVG into the ePub? I
> >  have no experience in hacking Pandoc.
> >  Best regards,
> >  Thomas Arildsen
> >
> >  --
> >  You received this message because you are subscribed to the Google
> >  Groups "pandoc-discuss" group.
> >  To unsubscribe from this group and stop receiving emails from it, send
> >  an email to [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> >  To post to this group, send email to
> >  [2]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> >  To view this discussion on the web visit
> >  [3]https://groups.google.com/d/msgid/pandoc-discuss/dfcf2e4b-b377-4d48-
> >  be9f-de82088e7832%40googlegroups.com.
> >  For more options, visit [4]https://groups.google.com/d/optout.
> >
> >References
> >
> >  1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> >  2. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> >  3. https://groups.google.com/d/msgid/pandoc-discuss/dfcf2e4b-b377-4d48-be9f-de82088e7832-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer
> >  4. https://groups.google.com/d/optout
> 
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/20150115203001.GA10846%40protagoras.berkeley.edu.
> For more options, visit https://groups.google.com/d/optout.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Maths in ebooks
       [not found]     ` <20150115203001.GA10846-nFAEphtLEs/fysO+viCLMa55KtNWUUjk@public.gmane.org>
  2015-01-15 20:32       ` a
@ 2015-01-15 21:24       ` Thomas Arildsen
       [not found]         ` <CAFQUsibyf8muK86Y5Ozj+9PfVBRgt-EAkjDAfU=4gy-wJ4e8mA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 18+ messages in thread
From: Thomas Arildsen @ 2015-01-15 21:24 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 4219 bytes --]

I should be able to take a stab at this in Python. I will get back to you
when I get time to try this. Thanks!
Den 15/01/2015 21.30 skrev "John MacFarlane" <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>:

> Seems to me it would not be hard to write a pandoc filter
> that did this.  There's an example filter in the
> pandocfilters repository that converts tikz images in
> LaTeX to images.  Something like that could work here too,
> only you'd match on 'Math' rather than 'RawBlock'.
>
> https://github.com/jgm/pandocfilters/blob/master/examples/tikz.py
>
> Filters can be written in Haskell or python (there are also
> libraries to facilitate writing them in php and perl).
>
>
> +++ Thomas Arildsen [Jan 15 15 00:59 ]:
>
>>   I have been experimenting with including maths in ebooks (ultimately
>>   because I would like to be able to publish my research as ebooks
>>   instead of PDF which I think is suboptimal for tablets etc.) One
>>   approach that sort of works for me is converting from Markdown with
>>   LaTeX maths to ePub where I can make Pandoc turn the maths into MathML.
>>   My problem is just that the MathML looks quite horrible in comparison
>>   to what LaTeX can usually produce in PDF etc.
>>   A fall-back solution for me could be to render the maths bitmapped and
>>   then include the images in the document. However, I recently figured
>>   out that ePub seems to support SVG as well and it is actually possible
>>   to turn LaTeX into SVG output (see e.g. http://dvisvg.sourceforge.net/
>>   and http://svgkit.sourceforge.net/SVGLaTeX.html). So far I have
>>   succeeded in doing this quite manually, but I was wondering if it would
>>   be possible to make Pandoc able to automate this conversion of math
>>   formulae into SVG with subsequent inclusion of the SVG into the ePub? I
>>   have no experience in hacking Pandoc.
>>   Best regards,
>>   Thomas Arildsen
>>
>>   --
>>   You received this message because you are subscribed to the Google
>>   Groups "pandoc-discuss" group.
>>   To unsubscribe from this group and stop receiving emails from it, send
>>   an email to [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>   To post to this group, send email to
>>   [2]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>   To view this discussion on the web visit
>>   [3]https://groups.google.com/d/msgid/pandoc-discuss/dfcf2e4b-b377-4d48-
>>   be9f-de82088e7832%40googlegroups.com.
>>   For more options, visit [4]https://groups.google.com/d/optout.
>>
>> References
>>
>>   1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>>   2. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>>   3. https://groups.google.com/d/msgid/pandoc-discuss/dfcf2e4b-
>> b377-4d48-be9f-de82088e7832-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=
>> email&utm_source=footer
>>   4. https://groups.google.com/d/optout
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "pandoc-discuss" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/pandoc-discuss/C_UIh0gDpwU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/pandoc-discuss/20150115203001.GA10846%40protagoras.berkeley.edu.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAFQUsibyf8muK86Y5Ozj%2B9PfVBRgt-EAkjDAfU%3D4gy-wJ4e8mA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 6744 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Maths in ebooks
  2015-01-15 20:32       ` a
@ 2015-01-15 21:24         ` Thomas Arildsen
       [not found]           ` <CAFQUsiZNNx=cMG9+Usrc5E=_sfN1Y7-3mF2Yv0OCmXdD4FJ0XA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2015-01-16  2:17         ` Raniere Silva
  2015-01-16  5:32         ` Paulo Ney de Souza
  2 siblings, 1 reply; 18+ messages in thread
From: Thomas Arildsen @ 2015-01-15 21:24 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 5544 bytes --]

After fiddling about a bit, I was also able to create fine-looking MathML
today, that is when opened in Calibre. I also tried opening it in Okular
with the ePub plugin and here it looked quite bad. Specifically, it seems
unable to place integral limits as sub- and superscript of the integral
sign.
Those readers are for my Ubuntu desktop PC. I have not tried my test
document in the Google e-reader I use on my phone yet.
Den 15/01/2015 21.32 skrev "a" <schleija-vj2UJld5H2Nn68oJJulU0Q@public.gmane.org>:

> The simple pandoc epubs I generated and displayed on my old Hanvon
> Reader and the Geeksphone looked just fine.
> Even the math is ok. Sure I would prefer SVG math, but it was quite
> readable.
> For plain text I don't see why the "pure ePub" is a problem.
>
>
> On Thu, Jan 15, 2015 at 12:30:01PM -0800, John MacFarlane wrote:
> > Seems to me it would not be hard to write a pandoc filter
> > that did this.  There's an example filter in the
> > pandocfilters repository that converts tikz images in
> > LaTeX to images.  Something like that could work here too,
> > only you'd match on 'Math' rather than 'RawBlock'.
> >
> > https://github.com/jgm/pandocfilters/blob/master/examples/tikz.py
> >
> > Filters can be written in Haskell or python (there are also
> > libraries to facilitate writing them in php and perl).
> >
> >
> > +++ Thomas Arildsen [Jan 15 15 00:59 ]:
> > >  I have been experimenting with including maths in ebooks (ultimately
> > >  because I would like to be able to publish my research as ebooks
> > >  instead of PDF which I think is suboptimal for tablets etc.) One
> > >  approach that sort of works for me is converting from Markdown with
> > >  LaTeX maths to ePub where I can make Pandoc turn the maths into
> MathML.
> > >  My problem is just that the MathML looks quite horrible in comparison
> > >  to what LaTeX can usually produce in PDF etc.
> > >  A fall-back solution for me could be to render the maths bitmapped and
> > >  then include the images in the document. However, I recently figured
> > >  out that ePub seems to support SVG as well and it is actually possible
> > >  to turn LaTeX into SVG output (see e.g.
> http://dvisvg.sourceforge.net/
> > >  and http://svgkit.sourceforge.net/SVGLaTeX.html). So far I have
> > >  succeeded in doing this quite manually, but I was wondering if it
> would
> > >  be possible to make Pandoc able to automate this conversion of math
> > >  formulae into SVG with subsequent inclusion of the SVG into the ePub?
> I
> > >  have no experience in hacking Pandoc.
> > >  Best regards,
> > >  Thomas Arildsen
> > >
> > >  --
> > >  You received this message because you are subscribed to the Google
> > >  Groups "pandoc-discuss" group.
> > >  To unsubscribe from this group and stop receiving emails from it, send
> > >  an email to [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > >  To post to this group, send email to
> > >  [2]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > >  To view this discussion on the web visit
> > >  [3]
> https://groups.google.com/d/msgid/pandoc-discuss/dfcf2e4b-b377-4d48-
> > >  be9f-de82088e7832%40googlegroups.com.
> > >  For more options, visit [4]https://groups.google.com/d/optout.
> > >
> > >References
> > >
> > >  1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> > >  2. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> > >  3.
> https://groups.google.com/d/msgid/pandoc-discuss/dfcf2e4b-b377-4d48-be9f-de82088e7832-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer
> > >  4. https://groups.google.com/d/optout
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "pandoc-discuss" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/20150115203001.GA10846%40protagoras.berkeley.edu
> .
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "pandoc-discuss" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/pandoc-discuss/C_UIh0gDpwU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/20150115203204.GB2131%40jhs-think
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAFQUsiZNNx%3DcMG9%2BUsrc5E%3D_sfN1Y7-3mF2Yv0OCmXdD4FJ0XA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 8531 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Maths in ebooks
       [not found]     ` <CAFVhNZPeDbtt+Tt3=8BYVX42XfFb=4RtaLGt29Ho-ik=QzeTSg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-01-15 21:29       ` Thomas Arildsen
       [not found]         ` <CAFQUsiZhZtAwzTDgUcpfOGkaP1gBSb5TRV+VeH0masuxq44QTA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Arildsen @ 2015-01-15 21:29 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 6384 bytes --]

I don't know the target ePub. I primarily want this to be able to offer a
screen-friendly version of research documents that I write and I don't know
what reader(s) to expect users to choose.
I can hear there is a lot of details to the CSS side of it as well, but for
now I am not so worried about the finer layout details. It's OK by me if
the document becomes very plain as long as it displays my formulae
correctly.
Well... it is not so simple ....

The first problem that arises is -- what is the "target ePub" -- specially
since you are talking about displaying it in a device, and in a way that is
better than PDF.

The kind of ePub produced by Pandoc is a sort of a "pure ePub" -- it
generates both ePub2 and ePub3 that passes validation with flying colors
but displays very poorly on the devices (iPad, Kobo, Nook, Google Play,
ADE, browser ePub display, converted to Kindle, etc ...). The main reasons
for that can be broken in two classes:

First is a CSS problem: Pandoc offers you a plain ePub and does not play
much with the CSS, while a LOT of what makes a good ePub relies on CSS.
This problem is resolvable, you just have to spend the time finding out
what is  the look you find the best and the target machine you want it for.

The second class of problems is much harder: Not all ePub elements are
supported by all manufacturers and programs and even then -- they make
their own choice on HOW to support it and their OWN interpretation on how
it should look like.

Ultimately every one of these ePub rendering engines use an HTML rendering
engine underneath, but manufacturers are not very open and forthcoming with
what rendering engine they are using for their reader -- very few release
that information and they change it all the time (now that rendering
engines are becoming a standard and a commodity). There are even reports
that a reader (Kobo) uses one rendering engine in one platform and another
elsewhere.

And up to now we have not even touched SVG ... and here the problem
iterates again... SVG is a standard (as MathML is) and as such manufactures
pick and choose which parts to use and support. It is fairly easy to make
an SVG for a circle that will not display on one or another rendering
engine.

For a look at the ePub3 Support Grid you can check:
http://epubtest.org/results/ and on http://epubtest.org/compare/ you can
see what pieces of the SVG standard are supported by each reader.

The problem is very similar to the one tackled by MathJax and KaTeX --
these are programs that stick their tongue out, feel the environment in the
user machine (browser, rendering engine, installed fonts, etc ...) and
prepare from sources the kind of HTML/MathML/CSS/Fonts it should be sent to
that reader.

We literally need to do the same for ePub, and start delivering the ePub
that is appropriate for one or another device...that will take some work!

Paulo Ney

PS.Just a remark - SVGLaTeX is a defunct project right now.







On Thu, Jan 15, 2015 at 2:59 AM, Thomas Arildsen <thomasarildsen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:

> I have been experimenting with including maths in ebooks (ultimately
> because I would like to be able to publish my research as ebooks instead of
> PDF which I think is suboptimal for tablets etc.) One approach that sort of
> works for me is converting from Markdown with LaTeX maths to ePub where I
> can make Pandoc turn the maths into MathML. My problem is just that the
> MathML looks quite horrible in comparison to what LaTeX can usually produce
> in PDF etc.
> A fall-back solution for me could be to render the maths bitmapped and
> then include the images in the document. However, I recently figured out
> that ePub seems to support SVG as well and it is actually possible to turn
> LaTeX into SVG output (see e.g. http://dvisvg.sourceforge.net/ and
> http://svgkit.sourceforge.net/SVGLaTeX.html). So far I have succeeded in
> doing this quite manually, but I was wondering if it would be possible to
> make Pandoc able to automate this conversion of math formulae into SVG with
> subsequent inclusion of the SVG into the ePub? I have no experience in
> hacking Pandoc.
> Best regards,
>
> Thomas Arildsen
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/dfcf2e4b-b377-4d48-be9f-de82088e7832%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/dfcf2e4b-b377-4d48-be9f-de82088e7832%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

 --
You received this message because you are subscribed to a topic in the
Google Groups "pandoc-discuss" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/pandoc-discuss/C_UIh0gDpwU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/pandoc-discuss/CAFVhNZPeDbtt%2BTt3%3D8BYVX42XfFb%3D4RtaLGt29Ho-ik%3DQzeTSg%40mail.gmail.com
<https://groups.google.com/d/msgid/pandoc-discuss/CAFVhNZPeDbtt%2BTt3%3D8BYVX42XfFb%3D4RtaLGt29Ho-ik%3DQzeTSg%40mail.gmail.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAFQUsiZhZtAwzTDgUcpfOGkaP1gBSb5TRV%2BVeH0masuxq44QTA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 8592 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Maths in ebooks
       [not found]         ` <CAFQUsiZhZtAwzTDgUcpfOGkaP1gBSb5TRV+VeH0masuxq44QTA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-01-15 22:43           ` John MacFarlane
  0 siblings, 0 replies; 18+ messages in thread
From: John MacFarlane @ 2015-01-15 22:43 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

+++ Thomas Arildsen [Jan 15 15 22:29 ]:
>   I don't know the target ePub. I primarily want this to be able to offer
>   a screen-friendly version of research documents that I write and I
>   don't know what reader(s) to expect users to choose.
>   I can hear there is a lot of details to the CSS side of it as well, but
>   for now I am not so worried about the finer layout details. It's OK by
>   me if the document becomes very plain as long as it displays my
>   formulae correctly.
>
>   Well... it is not so simple ....
>   The first problem that arises is -- what is the "target ePub" --
>   specially since you are talking about displaying it in a device, and in
>   a way that is better than PDF.
>   The kind of ePub produced by Pandoc is a sort of a "pure ePub" -- it
>   generates both ePub2 and ePub3 that passes validation with flying
>   colors but displays very poorly on the devices (iPad, Kobo, Nook,
>   Google Play, ADE, browser ePub display, converted to Kindle, etc ...).

There is both an epub (= eub2) and an epub3 target.  Use `-t epub3`
if you want to use MathML and produce epub v3.

>   The main reasons for that can be broken in two classes:
>   First is a CSS problem: Pandoc offers you a plain ePub and does not
>   play much with the CSS, while a LOT of what makes a good ePub relies on
>   CSS. This problem is resolvable, you just have to spend the time
>   finding out what is  the look you find the best and the target machine
>   you want it for.

Yes, pandoc allows you to specify a file with the CSS you want.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Maths in ebooks
       [not found]           ` <CAFQUsiZNNx=cMG9+Usrc5E=_sfN1Y7-3mF2Yv0OCmXdD4FJ0XA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-01-16  0:55             ` Beni Cherniavsky-Paskin
       [not found]               ` <CALJxei+TNrf+LGZTOQF_KKN+fYjBXxJyS51y1wYSyf2pQxQ19w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2015-01-16  2:23             ` Raniere Silva
  1 sibling, 1 reply; 18+ messages in thread
From: Beni Cherniavsky-Paskin @ 2015-01-16  0:55 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 7457 bytes --]

http://docs.mathjax.org/en/latest/misc/epub.html lists quite a few epub
readers that (try to) support MathML.
Suspiciously, most or all desktop or mobile apps; I'm afraid physical
ereader devices with proprietary software do much worse...

--

https://github.com/mathjax/MathJax-node might be a lighter alternative than
TeX for generating math SVGs.

KaTeX converts math (currently supports much less than MathJax)
to browser-independent HTML + CSS + web fonts.
(You can use it for client-side JavaScript rendering, but there is also a
command-line script to take math and produce static HTML fragment.)
By independent I mean it doesn't tweak it per-browser like MathJax does[^1]
in HTML output mode, but it does require somewhat modern browsers; no idea
whether it will work in ePub readers...

[^1]: MathJax 2.5 also introduced a browser-independent mode ("CommonHTML")
but so far it's ugly, only suitable as fast preview.

2015-01-15 23:24 GMT+02:00 Thomas Arildsen <thomas-QIklGeMt0Llg9hUCZPvPmw@public.gmane.org>:

> After fiddling about a bit, I was also able to create fine-looking MathML
> today, that is when opened in Calibre. I also tried opening it in Okular
> with the ePub plugin and here it looked quite bad. Specifically, it seems
> unable to place integral limits as sub- and superscript of the integral
> sign.
> Those readers are for my Ubuntu desktop PC. I have not tried my test
> document in the Google e-reader I use on my phone yet.
> Den 15/01/2015 21.32 skrev "a" <schleija-vj2UJld5H2Nn68oJJulU0Q@public.gmane.org>:
>
>> The simple pandoc epubs I generated and displayed on my old Hanvon
>> Reader and the Geeksphone looked just fine.
>> Even the math is ok. Sure I would prefer SVG math, but it was quite
>> readable.
>> For plain text I don't see why the "pure ePub" is a problem.
>>
>>
>> On Thu, Jan 15, 2015 at 12:30:01PM -0800, John MacFarlane wrote:
>> > Seems to me it would not be hard to write a pandoc filter
>> > that did this.  There's an example filter in the
>> > pandocfilters repository that converts tikz images in
>> > LaTeX to images.  Something like that could work here too,
>> > only you'd match on 'Math' rather than 'RawBlock'.
>> >
>> > https://github.com/jgm/pandocfilters/blob/master/examples/tikz.py
>> >
>> > Filters can be written in Haskell or python (there are also
>> > libraries to facilitate writing them in php and perl).
>> >
>> >
>> > +++ Thomas Arildsen [Jan 15 15 00:59 ]:
>> > >  I have been experimenting with including maths in ebooks (ultimately
>> > >  because I would like to be able to publish my research as ebooks
>> > >  instead of PDF which I think is suboptimal for tablets etc.) One
>> > >  approach that sort of works for me is converting from Markdown with
>> > >  LaTeX maths to ePub where I can make Pandoc turn the maths into
>> MathML.
>> > >  My problem is just that the MathML looks quite horrible in comparison
>> > >  to what LaTeX can usually produce in PDF etc.
>> > >  A fall-back solution for me could be to render the maths bitmapped
>> and
>> > >  then include the images in the document. However, I recently figured
>> > >  out that ePub seems to support SVG as well and it is actually
>> possible
>> > >  to turn LaTeX into SVG output (see e.g.
>> http://dvisvg.sourceforge.net/
>> > >  and http://svgkit.sourceforge.net/SVGLaTeX.html). So far I have
>> > >  succeeded in doing this quite manually, but I was wondering if it
>> would
>> > >  be possible to make Pandoc able to automate this conversion of math
>> > >  formulae into SVG with subsequent inclusion of the SVG into the
>> ePub? I
>> > >  have no experience in hacking Pandoc.
>> > >  Best regards,
>> > >  Thomas Arildsen
>> > >
>> > >  --
>> > >  You received this message because you are subscribed to the Google
>> > >  Groups "pandoc-discuss" group.
>> > >  To unsubscribe from this group and stop receiving emails from it,
>> send
>> > >  an email to [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> > >  To post to this group, send email to
>> > >  [2]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> > >  To view this discussion on the web visit
>> > >  [3]
>> https://groups.google.com/d/msgid/pandoc-discuss/dfcf2e4b-b377-4d48-
>> > >  be9f-de82088e7832%40googlegroups.com.
>> > >  For more options, visit [4]https://groups.google.com/d/optout.
>> > >
>> > >References
>> > >
>> > >  1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> > >  2. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>> > >  3.
>> https://groups.google.com/d/msgid/pandoc-discuss/dfcf2e4b-b377-4d48-be9f-de82088e7832-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer
>> > >  4. https://groups.google.com/d/optout
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "pandoc-discuss" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> > To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> > To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pandoc-discuss/20150115203001.GA10846%40protagoras.berkeley.edu
>> .
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "pandoc-discuss" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/pandoc-discuss/C_UIh0gDpwU/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pandoc-discuss/20150115203204.GB2131%40jhs-think
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/CAFQUsiZNNx%3DcMG9%2BUsrc5E%3D_sfN1Y7-3mF2Yv0OCmXdD4FJ0XA%40mail.gmail.com
> <https://groups.google.com/d/msgid/pandoc-discuss/CAFQUsiZNNx%3DcMG9%2BUsrc5E%3D_sfN1Y7-3mF2Yv0OCmXdD4FJ0XA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CALJxei%2BTNrf%2BLGZTOQF_KKN%2BfYjBXxJyS51y1wYSyf2pQxQ19w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 11494 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Maths in ebooks
       [not found] ` <dfcf2e4b-b377-4d48-be9f-de82088e7832-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2015-01-15 17:51   ` Paulo Ney de Souza
  2015-01-15 20:30   ` John MacFarlane
@ 2015-01-16  2:11   ` Raniere Silva
       [not found]     ` <20150116021144.GW19197-j/q8TITqDDESy/uc2pLa89BPR1lH4CV8@public.gmane.org>
  2 siblings, 1 reply; 18+ messages in thread
From: Raniere Silva @ 2015-01-16  2:11 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 2739 bytes --]

Hi Thomas,

Paulo Ney de Souza wrote a amazing reply for you. I just want to add some
points,

> I have been experimenting with including maths in ebooks (ultimately 
> because I would like to be able to publish my research as ebooks instead of 
> PDF which I think is suboptimal for tablets etc.)

I also do that in the past few months.

> One approach that sort of 
> works for me is converting from Markdown with LaTeX maths to ePub where I 
> can make Pandoc turn the maths into MathML.

I try this same approach and was a little unhappy due
https://github.com/jgm/pandoc/issues/1764.

> My problem is just that the 
> MathML looks quite horrible in comparison to what LaTeX can usually produce 
> in PDF etc.

MathML rendering tools isn't as good as LaTeX. Firefox/Gecko has the best
implementation so far. "Community WebKit" (e.g. used by [Epiphany]) and
"Apple Webkit" (e.g. used by Safari) have some basic support to MathML 
but Chromium/Chrome don't have neither Internet Explorer.

Most of the EPUB readers that support MathML use Gecko as rendering engine or
MathJax that requires Javascript enabled.

> A fall-back solution for me could be to render the maths bitmapped and then 
> include the images in the document.

This is the recommendation if you read EPUB specification.

> However, I recently figured out that 
> ePub seems to support SVG as well and it is actually possible to turn LaTeX 
> into SVG output (see e.g. http://dvisvg.sourceforge.net/ and 
> http://svgkit.sourceforge.net/SVGLaTeX.html).

That's true. Wikipedia does it.

> So far I have succeeded in 
> doing this quite manually, but I was wondering if it would be possible to 
> make Pandoc able to automate this conversion of math formulae into SVG with 
> subsequent inclusion of the SVG into the ePub?

LaTeX math or MathML to SVG isn't a easy task and also have the problem that
some rendering engine will not work as expected.

I don't know if you know [LaTeXML]. It convert LaTeX to HTML with support for
math as bitmapped, SVG and MathML. I will invite you to try using it.

Cheers,
Raniere

[Epiphany]: https://wiki.gnome.org/Apps/Web
[LaTeXML] https://github.com/brucemiller/LaTeXML/

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/20150116021144.GW19197%40buriti.rgaiacs.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Maths in ebooks
  2015-01-15 20:32       ` a
  2015-01-15 21:24         ` Thomas Arildsen
@ 2015-01-16  2:17         ` Raniere Silva
       [not found]           ` <20150116021752.GX19197-j/q8TITqDDESy/uc2pLa89BPR1lH4CV8@public.gmane.org>
  2015-01-16  5:32         ` Paulo Ney de Souza
  2 siblings, 1 reply; 18+ messages in thread
From: Raniere Silva @ 2015-01-16  2:17 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]

Hi schleija,

> The simple pandoc epubs I generated and displayed on my old Hanvon              
> Reader and the Geeksphone looked just fine.                                     

Is the first time that I heard of Hanvon Reader. Back in October I did some
tests with my Nook, see http://ftb.rgaiacs.com/2014/10/13/mathml_ereaders.html,
and was unhappy with the output. Could you send me some photos of your Hanvon
Reader rendering the example that I used in my test?

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/20150116021752.GX19197%40buriti.rgaiacs.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Maths in ebooks
       [not found]           ` <CAFQUsiZNNx=cMG9+Usrc5E=_sfN1Y7-3mF2Yv0OCmXdD4FJ0XA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2015-01-16  0:55             ` Beni Cherniavsky-Paskin
@ 2015-01-16  2:23             ` Raniere Silva
  1 sibling, 0 replies; 18+ messages in thread
From: Raniere Silva @ 2015-01-16  2:23 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 1428 bytes --]

Hi Thomas,

> After fiddling about a bit, I was also able to create fine-looking MathML
> today, that is when opened in Calibre. I also tried opening it in Okular
> with the ePub plugin and here it looked quite bad. Specifically, it seems
> unable to place integral limits as sub- and superscript of the integral
> sign.

Calibre uses MathJax and that's why you get a fine-looking MathML.

I believe that the plugin for Okular doesn't use MathJax and that's why you get
troubles with sub- and superscript.

> Those readers are for my Ubuntu desktop PC. I have not tried my test
> document in the Google e-reader I use on my phone yet.

[Readium] also uses MathJax and was design for Google Chrome. I don't remember
if they have an app.

And the Geeksphones that I know, the ones running Firefox OS, are using Gecko as
rendering engine.

[Readium]: http://readium.org/

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/20150116022336.GY19197%40buriti.rgaiacs.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Maths in ebooks
       [not found]     ` <20150116021144.GW19197-j/q8TITqDDESy/uc2pLa89BPR1lH4CV8@public.gmane.org>
@ 2015-01-16  5:08       ` Paulo Ney de Souza
  2015-01-16  6:13       ` John MacFarlane
  1 sibling, 0 replies; 18+ messages in thread
From: Paulo Ney de Souza @ 2015-01-16  5:08 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 2600 bytes --]

On Thu, Jan 15, 2015 at 6:11 PM, Raniere Silva <raniere-Xhq86aZylhRTIXuwt5Zssw@public.gmane.org>
wrote:

>
> MathML rendering tools isn't as good as LaTeX. Firefox/Gecko has the best
> implementation so far. "Community WebKit" (e.g. used by [Epiphany]) and
> "Apple Webkit" (e.g. used by Safari) have some basic support to MathML
> but Chromium/Chrome don't have neither Internet Explorer.
>


I would like to add that even Firefox/Gecko having one of the best support
for MathML around -- it is still not enough! Under certain situations even
if you feed MathJax certain MathML code it will revert back to HTML+CSS
depending on the Firefox version of the user... because it know the
shortcomings of the browser.

Frédéric Wang has worked intensively in fixing the MathML display bugs in
Gecko and WebKit, and when the masters fold his code in -- we will have a
nicer MathML level display in HTML engines. Anyone interested should check
his blog:

          http://www.maths-informatique-jeux.com/blog/frederic/



> Most of the EPUB readers that support MathML use Gecko as rendering engine
> or
> MathJax that requires Javascript enabled.
>


And the ones that don't are almost all using Adobe Digital Editions for
rendering engine - one of the worst out there! I am writing a paper "On
determining the HTML rendering engine of ePub readers" (based on what they
do wrong with CSS) and this was a big surprise for me. It looks like things
are changing and Kobo started to move away from ADE, but overall the
industry is moving very slowly.


> However, I recently figured out that
> > ePub seems to support SVG as well and it is actually possible to turn
> LaTeX
> > into SVG output (see e.g. http://dvisvg.sourceforge.net/ and
> > http://svgkit.sourceforge.net/SVGLaTeX.html).
>
> That's true. Wikipedia does it.
>

The caveat being ... the support of SVG in browsers is roughly two years
ahead of support of SVG in ePub readers.


Paulo Ney

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAFVhNZNHxOtTmSrsOn%3Dwp9Nvmz0L%2BKd6%2B51Q7TOMJVNKZ%3DOW4w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 4079 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Maths in ebooks
       [not found]               ` <CALJxei+TNrf+LGZTOQF_KKN+fYjBXxJyS51y1wYSyf2pQxQ19w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-01-16  5:10                 ` Paulo Ney de Souza
  0 siblings, 0 replies; 18+ messages in thread
From: Paulo Ney de Souza @ 2015-01-16  5:10 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 1045 bytes --]

On Thu, Jan 15, 2015 at 4:55 PM, Beni Cherniavsky-Paskin <
beni.cherniavsky-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> http://docs.mathjax.org/en/latest/misc/epub.html lists quite a few epub
> readers that (try to) support MathML.
> Suspiciously, most or all desktop or mobile apps; I'm afraid physical
> ereader devices with proprietary software do much worse...
>
>
Since most of them are using outdated Adobe DE as ePub rendering engine.

Paulo Ney

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAFVhNZOq7t5CE7K37-zpMotvcV9jCqM8od3W1u5kN7Krp7PtqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 1941 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Maths in ebooks
       [not found]           ` <20150116021752.GX19197-j/q8TITqDDESy/uc2pLa89BPR1lH4CV8@public.gmane.org>
@ 2015-01-16  5:24             ` Paulo Ney de Souza
  0 siblings, 0 replies; 18+ messages in thread
From: Paulo Ney de Souza @ 2015-01-16  5:24 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 1319 bytes --]

On Thu, Jan 15, 2015 at 6:17 PM, Raniere Silva <raniere-Xhq86aZylhRTIXuwt5Zssw@public.gmane.org>
wrote:

> Hi schleija,
>
> > The simple pandoc epubs I generated and displayed on my old Hanvon
> > Reader and the Geeksphone looked just fine.
>
> Is the first time that I heard of Hanvon Reader. Back in October I did some
> tests with my Nook, see
> http://ftb.rgaiacs.com/2014/10/13/mathml_ereaders.html,
> and was unhappy with the output. Could you send me some photos of your
> Hanvon
> Reader rendering the example that I used in my test?
>


I am really curious too! This reader uses a *really*  outdated version of
ADE and as such, can't display much math at all!  Please send photos, and
the files, if you could?

Paulo Ney

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAFVhNZOYXzDxepTm2mLWMLrxo0Bmd5-SQ5jKFN3%3D7eCm%3D-hQpg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 2256 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Maths in ebooks
  2015-01-15 20:32       ` a
  2015-01-15 21:24         ` Thomas Arildsen
  2015-01-16  2:17         ` Raniere Silva
@ 2015-01-16  5:32         ` Paulo Ney de Souza
  2 siblings, 0 replies; 18+ messages in thread
From: Paulo Ney de Souza @ 2015-01-16  5:32 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 913 bytes --]

On Thu, Jan 15, 2015 at 12:32 PM, a <schleija-vj2UJld5H2Nn68oJJulU0Q@public.gmane.org> wrote:

> The simple pandoc epubs I generated and displayed on my old Hanvon
> Reader and the Geeksphone looked just fine.
>


What OS are you using with the GeeksPhone ? Android or Firefox OS ? And
which epub reader was used ?

Paulo Ney

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAFVhNZNhhaQoKxfe%3DH2v3yrrXzL-tXHQYwKhexPgEAQ5pODH1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 1715 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Maths in ebooks
       [not found]     ` <20150116021144.GW19197-j/q8TITqDDESy/uc2pLa89BPR1lH4CV8@public.gmane.org>
  2015-01-16  5:08       ` Paulo Ney de Souza
@ 2015-01-16  6:13       ` John MacFarlane
  1 sibling, 0 replies; 18+ messages in thread
From: John MacFarlane @ 2015-01-16  6:13 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

By the way, if you want to use bitmapped math, you can
try the --webtex or --gladtex options in pandoc.  I've
seen these work with epubs, though the result doesn't
usually match the text's typography well.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Maths in ebooks
       [not found]         ` <CAFQUsibyf8muK86Y5Ozj+9PfVBRgt-EAkjDAfU=4gy-wJ4e8mA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-01-16  6:13           ` Paulo Ney de Souza
  0 siblings, 0 replies; 18+ messages in thread
From: Paulo Ney de Souza @ 2015-01-16  6:13 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- Attachment #1: Type: text/plain, Size: 1275 bytes --]

On Thu, Jan 15, 2015 at 1:24 PM, Thomas Arildsen <thomas-QIklGeMt0Llg9hUCZPvPmw@public.gmane.org>
wrote:

> I should be able to take a stab at this in Python. I will get back to you
> when I get time to try this. Thanks!
>
>
If you really going to tackle it, and specially in Python, I would
recommend dropping both DVISVG and SVGKit (old, unmaintained and abandoned
projects) and use the excellent project EQTeXSVG by Julien Vitard:

    https://github.com/julienvitard/eqtexsvg/
    http://www.julienvitard.eu/en/eqtexsvg_en.html

which is based on "dvisvgm" and includes a script that produces the best
SVG code out of TeX I have seen, and it is well supported by the author.

Paulo Ney

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAFVhNZN-rBFUQYsab6v9XbghpDZdOoLU38yGZdUnmuwyyK7dUQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #2: Type: text/html, Size: 2278 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2015-01-16  6:13 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-15  8:59 Maths in ebooks Thomas Arildsen
     [not found] ` <dfcf2e4b-b377-4d48-be9f-de82088e7832-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2015-01-15 17:51   ` Paulo Ney de Souza
     [not found]     ` <CAFVhNZPeDbtt+Tt3=8BYVX42XfFb=4RtaLGt29Ho-ik=QzeTSg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-15 21:29       ` Thomas Arildsen
     [not found]         ` <CAFQUsiZhZtAwzTDgUcpfOGkaP1gBSb5TRV+VeH0masuxq44QTA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-15 22:43           ` John MacFarlane
2015-01-15 20:30   ` John MacFarlane
     [not found]     ` <20150115203001.GA10846-nFAEphtLEs/fysO+viCLMa55KtNWUUjk@public.gmane.org>
2015-01-15 20:32       ` a
2015-01-15 21:24         ` Thomas Arildsen
     [not found]           ` <CAFQUsiZNNx=cMG9+Usrc5E=_sfN1Y7-3mF2Yv0OCmXdD4FJ0XA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-16  0:55             ` Beni Cherniavsky-Paskin
     [not found]               ` <CALJxei+TNrf+LGZTOQF_KKN+fYjBXxJyS51y1wYSyf2pQxQ19w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-16  5:10                 ` Paulo Ney de Souza
2015-01-16  2:23             ` Raniere Silva
2015-01-16  2:17         ` Raniere Silva
     [not found]           ` <20150116021752.GX19197-j/q8TITqDDESy/uc2pLa89BPR1lH4CV8@public.gmane.org>
2015-01-16  5:24             ` Paulo Ney de Souza
2015-01-16  5:32         ` Paulo Ney de Souza
2015-01-15 21:24       ` Thomas Arildsen
     [not found]         ` <CAFQUsibyf8muK86Y5Ozj+9PfVBRgt-EAkjDAfU=4gy-wJ4e8mA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-16  6:13           ` Paulo Ney de Souza
2015-01-16  2:11   ` Raniere Silva
     [not found]     ` <20150116021144.GW19197-j/q8TITqDDESy/uc2pLa89BPR1lH4CV8@public.gmane.org>
2015-01-16  5:08       ` Paulo Ney de Souza
2015-01-16  6:13       ` John MacFarlane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).