ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* LuaMetaTEX as LaTeX to XHTML/ePub transpiler?
@ 2021-09-10 11:13 Hugh Fisher via ntg-context
  2021-09-10 11:26 ` Henning Hraban Ramm via ntg-context
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Hugh Fisher via ntg-context @ 2021-09-10 11:13 UTC (permalink / raw)
  To: ntg-context; +Cc: Hugh Fisher

I have documents in LaTeX, and would like to generate XHTML (ePub)
output without going through an intermediate DVI or PDF step.
Markup to markup, translating or transpiling rather than typesetting.

My use case is that I have two tabletop gaming books, 60 - 80 pages
of text and diagrams, written for pdfLaTeX and now with XeLaTeX. I'm
very happy with LaTeX and the wonderful PDF output for print.

But now I also want to create ePub/XHTML as well as print versions.
So far I've tried tex4ebook and tex4ht and neither works for me.
Firstly, some of the LaTeX commands are not recognised or causing
errors.

And secondly, when I managed to get a small test section to work,
the generated XHTML/HTML is very large, full of tiny <span>s. The
problem seems to be that tex4ht runs TeX which typesets everything
into DVI with every element carefully placed on a page, and then
tex4ht tries to reverse that back into HTML. All this extra HTML
will slow down / interfere with the ebook reader which is doing the
final page layout at runtime on a particular device.

How I would like it to work is directly from LaTeX to HTML without
any low level typesetting. If I have a LaTex source paragraph

    This is some text with \textbf{some parts} in bold.

The <whatever>TEX will copy the source text to the destination. If
there's a TeX command, here \textbf, it looks for a Lua function
with that name and invokes it with whatever argument text is present.
The Lua function emits <b>, then recursively processes the argument
text, then emits </b>. Similarly there would be an implied lookup
of \beginParagraph and \endParagraph which would emit <p> and </p>.
Plain text just gets copied through unchanged.


So (finally) my question: is LuaMetaTEX what I'm looking for?

Yes is the answer I'm hoping for. And any guidance would be much
appreciated.

No, but best starting point? I've never tried modifying TeX code
itself, but I am an experienced and sometimes competent programmer.
who has written a compiler parser and a high level code generator.

No and not a good idea to try?

Any other responses?


-- 

        cheers,
        Hugh Fisher
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2021-09-11 12:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-10 11:13 LuaMetaTEX as LaTeX to XHTML/ePub transpiler? Hugh Fisher via ntg-context
2021-09-10 11:26 ` Henning Hraban Ramm via ntg-context
2021-09-11 11:14   ` Hugh Fisher via ntg-context
2021-09-10 11:47 ` Hans Hagen via ntg-context
2021-09-11 11:19   ` Hugh Fisher via ntg-context
2021-09-11 12:00     ` Hans Hagen via ntg-context
2021-09-10 15:34 ` Denis Maier via ntg-context
2021-09-10 15:50   ` Denis Maier via ntg-context
2021-09-11 11:49   ` Hugh Fisher via ntg-context
2021-09-11 12:03     ` Hans Hagen via ntg-context

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).