On Mon, 4 Nov 2019 09:07:13 +0000 Yon <anas...@bardinflor.perso.aquilenet.fr> wrote:
> On Mon, Nov 04, 2019 at 02:27:38AM -0500, Steve Litt wrote: > > I'm not sure, but I think if you write with a certain subset of > > TeX, it would be fairly easy to write a program to convert it to > > XHTML5, from which you can pretty easily create ePubs. Plain TeX as > > made by Knuth is indeed simple for all simple things, and doable > > for more complicated things. > I do not think it's easy to define a subset of TeX and stick > to it. I've used pandoc in the past to convert reasonably > semantic LaTeX files to EPUB, and sticking to the right > subset without accidentally using non supported commands was > difficult at the time. Careful review of the produced EPUB > was needed. Quite a nightmare. Thankfully, all of this > ended the day I wasn't able anymore to compile pandoc and > its hundred or so dependencies for OpenBSD :-) I can imagine that LaTeX subsets would be a nightmare. So would HTML subsets. But TeX is simple enough that avoiding a few esoteric things won't be difficult. > > Maybe there are better TeX to EPUB tools now - I haven't > tried combining tex4ht with calibre for a long time, for > example. Using a presentational format like dvi as > intermediate representation is a sign that TeX is unsuitable > as a common source, but it may work well enough > nevertheless. Ah, yes, I've never heard of a way to convert dvi to HTML. I was referring to writing a fairly simple conversion program that takes TeX and converts it directly to HTML, style for style, word for word. And this is where the subset comes in: \mymacro{The quick sly fox jumped over the lazy brown dog.} In the preceding, there's a rule that the closing brace must be on the same line. This makes the parsing program much simpler. And for: \beginMyMacro One reason so many folks like OpenBSD is that it's solid. It works and keeps working, without the little bugs and crashes of other distributions and operating systems. And of course there's the security angle, which is OpenBSD's forte. \endMyMacro In the preceding paragraph, \beginMyMacro and \endMyMacro occur on their own line. Once again, a lot easier to parse. It's not absolutely necessary to make these restrictions, but not making them makes the conversion program harder to code. > > Otherwise, if both LaTeX and EPUB outputs are needed, and > fine-grained control of the produced EPUB is wanted, using a > well-defined intermediate markup language seems the safest > way to go. Oddly enough for me, markdown still appears to > be the most common choice. Ex-Actly. I use Asciidoctor for the same purpose for the same reason. > I would have thought that its > caracteristics - semantically poor, with irregular and > no-warnings “every text file accepted” permissive kind of > syntax - would have made it unsuitable for maintaining long > works. I haven't actually used Markdown for this, but I researched it plenty before settling on Asciidoctor. I think for a simple book with simple formatting, Markdown would work beautifully. If you needed a bibliography or if you needed to declare and use your own styles, Markdown might prove insufficient. SteveT Steve Litt November 2019 featured book: Manager's Guide to Technical Troubleshooting Second edition http://www.troubleshooters.com/mgr