w3c / publishingcg

Repository of the Publishing Community Group
https://www.w3.org/community/publishingcg/
Other
19 stars 6 forks source link

Embed latex in epub? #37

Open Jeffxz opened 2 years ago

Jeffxz commented 2 years ago

Introduction

As a student I would like to have latex included in epub so that I could have the raw latex data when reading.

Explanation:

T.B.D

iherman commented 2 years ago

I am not sure I understand what you mean. I can see two interpretations:

  1. You generate the HTML from the original LaTeX source, but you would like to have the original LaTeX as part of the container
  2. You want to use only LaTeX, and expect the reading system to, essentially, make the conversion of LaTeX to HTML on-the-fly to display it.

(1) above is already doable, you can store any file type in EPUB. The only question is how the reading system would display such a file: I would expect that would be plain text. At the moment, there is also a fallback requirement (although that may be an under-implemented feature...), and it would require some additions to the spec if we want to avoid that.

However, I do not see (2) happening in reading systems. Actually, LaTeX users are used to make conversions of their source before any sort of publications and this conversion would be done up stream (typical example is ACM: publications can be submitted to ACM in LaTeX as well as in MS Word, and they do the conversion to HTML and/or PDF).

Maybe you had a third alternative in mind...

mattgarrish commented 2 years ago

Files can travel in the epub without needing fallbacks. So long as you provide text instructions on how to extract the latex file you wouldn't have to worry about fallbacks. Once you try to link to the file from the content, though...

You can also embed raw latext in the HTML if you want it visible to the reader (e.g., in pre blocks). Nothing wrong with that.

You could also put it inside of script tags, but that's probably harder to get to then having a separate file with the latex. We'd also have to exempt script data blocks from core media type requirements. It's kind of odd that we don't since the data in a script block would have to be manipulated by a script to be readable, halfway meeting our requirement to transform non-core media type content into html/svg. We only seem to allow external data files for scripts to use.

Jeffxz commented 2 years ago

Thanks folks. This was brought up by @GeorgeKerscher during last CG meeting. Do you have some more insight about this use case? @GeorgeKerscher

clapierre commented 2 years ago

The use-case I am envisioning is a student would want a way to extract the LaTeX equation from the EPUB and put it into their own LaTeX editor so they can interact with it directly. If the raw LaTeX is visible those who write raw LaTex in ascii editors would be able to understand this, I would see this as either a link to the raw LaTeX or within an HTML Summary/Details.