Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
4  
You might be interested in this blog post: tex.blogoverflow.com/2011/07/getting-latex-on-to-the-web –  Caramdir Dec 13 '11 at 2:47
1  
In ConTeXt, this can be achieved by adding \setupbackend[export=yes,xhtml=yes] at the top of your file. –  Aditya Dec 13 '11 at 6:57
5  
This is more-or-less what TeX4ht does. Could you explain what the issue is with that approach? –  Joseph Wright Dec 13 '11 at 7:37
    
Caramdir > Looks interesting, but there's no code there and I was looking for HTML not plain text. I wanted to preserve tables, figures etc. –  Alex Dec 14 '11 at 0:55
add comment

1 Answer

up vote 2 down vote accepted

(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 http://www.math.ntnu.no/~stacey/HowDidIDoThat/LaTeX/internet.html 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.)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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