8

I know there are a lot of threads on existing Tex-HTML converters already, but I have a question about the feasibility of creating one.

Existing tools use other scripting languages to parse raw TeX and output HTML.

Would it be a better idea to write a package for TeX that overrides commands and outputs content to a HTML file?

For instance overriding \section to write a <h1>{content}</h1> tag to another file.

Is this feasible? I'm sure everyone knows more about TeX than me so I'd like to hear your thoughts.

3

(This is as much an answer to get this off the "unanswered" list as anything else.)

This is feasible. I've started writing such a package and have used it successfully for many projects: all of my blog posts on the TeX-SX blog were written in LaTeX and I now write my major contributions to the nLab in LaTeX, including converting an article that wasn't written specifically for use with my package.

I do intend releasing the code soon (to reply to your comment on the blog post). There's a few things I'd like to get right before releasing an alpha release (I keep changing my mind on how to deal with certain things that either need a slick catcode change or a more heavy duty macro). Keep hassling me and I might just get round to it! There is an early version available at https://github.com/loopspace/latex-to-internet but it has changed a lot since then.

To comment on your comment to Caramdir: the export is not plain text but is usually some variant of Markdown; also, if you notice, several of my blog posts have pictures. Those were done in TikZ and exported to PNG via my package. So there is rudimentary support for pictures.

(I'd also like to say that this package would not have been possible without this site. Many of the issues I encountered were solved thanks to people here.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.