views:

1578

answers:

12

Latex-to-html converters I've seen in the past have been pretty awful. Editing raw html is no fun and doesn't seem to translate well to the printed page. How do others solve this problem? Links to examples (both pdf and html) would be great.

Added: This question is pretty similar, though specifically about books:

http://stackoverflow.com/questions/78319/writing-a-book-and-targeting-pdf-and-html

Added: Another similar question was just asked:

http://stackoverflow.com/questions/603272/what-formatting-language

+4  A: 

You could take a step back and use something like DocBook and render to PDF via LaTeX and HTML straight from the DocBook files. Alternatively, Adobe Technical Communication Suite (Framemaker) will let you single-source a document to PDF and HTML. See this posting for a rundown on various technical documentation systems.

ConcernedOfTunbridgeWells
+1 - you can also go straight from docbook to pdf and html (and some other formats like helpfiles) without LaTeX in between using docbook-xsl
frankodwyer
I bet the typesetting to PDF isn't as good when you bypass LaTeX, though :) Unless there have been big changes I haven't heard about...
Will Robertson
+5  A: 

Yes, LaTeX-to-HTML converters used to suck (you've probably tried LaTeX2HTML), but of late they've got better. Tex4ht is highly configurable, and produces nice XHTML+CSS. See also other converters.

You can also use Docbook, if you can bear to write in it. There are converters from DocBook to both HTML and LaTeX (or to PDF directly); an example of the latter is dblatex.

See this post: LaTeX vs Docbook.

ShreevatsaR
tex4ht is no picknick either, and neither is Hevea. Somehow they all suck. Debugging latex2html (0.96) was the worst experience of my entire programming career. An over 1MB perl scripttex4ht sometimes screws links totally, and there are some unfriendly beginner gotcha's (e.g. ligatures)
Marco van de Voort
They all suck, but some suck less than others. :-) (Have you tried plasTeX, BTW? http://plastex.sourceforge.net/ )
ShreevatsaR
No, I'll have a look, but seeing it is in Python doesn't make me happy
Marco van de Voort
A: 

I'm not sure that latex is really the best tool for this. The trouble you're having with the usual latex to html converter is indicative of the problem: html is simple not as expressive as latex.

If you insist on latex to html, take care to use a limited subset that can convert reasonably.

dmckee
+1  A: 

PlasTeX looks like a nice latex-to-html converter, though I haven't tried it myself.

My friend Rob Felty wrote a blog post extolling its virtues: http://blog.robfelty.com/2008/03/19/finally-a-better-latex-to-html-converter/

dreeves
A: 

AsciiDoc looks like an interesting possibility.

dreeves
A: 

I've used TeXinfo in the past and it does a good job. Here's an example: http://yootles.com/api. I'd prefer to stick with LaTeX though instead of use another language.

dreeves
A: 

LaTeX? Seriously? I wasn't aware anyone outside academia still used it. I'd go with HTML, which you can save as PDF from the web browser. If you really must have some advanced typographic stuff, go with Word instead - it has a way to save to HTML (probably not as clean as one would like), and you can save as PDF with a free plug-in (downloadable separately).

Oh, and I wouldn't bother using things like InDesign - they are overkill. Also, don't bother paying for Acrobat Professional - there is a zillion free solutions available.

Dmitri Nesteruk
Dare I presume that the question was downvoted by LaTeX fans?
Dmitri Nesteruk
It wasn't me, but suggesting that Word is an adequate replacement for latex looks very hard to defend to me... I generally suggest Word with style sheets to my less technically inclined friends, but they are not the same thing.
dmckee
Wasn't me either, but the question says "(ideally in LaTeX)" and "html is no fun and doesn't seem to translate well to the printed page", and this answer recommends the exact opposite of what is wanted. Plus yeah, I guess "some advanced typographic stuff, go with Word" must have sounded crazy :-)
ShreevatsaR
Many hackers *are* in academia, and in fact there are good reasons academics prefer it. Eg, if you use much math in your documentation, nothing else really compares, in my opinion. I think it's great to have contrary opinions though. (The downvotes might just for the incredulous tone.)
dreeves
Well, if you look at what format science journals and book publishers use nowadays, it's Word, not LaTeX.
Dmitri Nesteruk
Downvoted because of the implication that Word can typeset documents.
Arafangion
"what format science journals and book publishers use nowadays, it's Word, not LaTeX. " false ... How can you use Word for mathematicals Symbols ?
Nadir SOUALEM
"Well, if you look at what format science journals and book publishers use nowadays, it's Word, not LaTeX. "No in my field. It's a 70% LateX - 30% Word in Signal Processing.
poulejapon
+1  A: 

This is a personal choice but Latex in theory is perfect however in practice it's pain-in-the-arse. I'm using VS.NET HTML editor + raw HTML edit when I need it.

So I think using an WSIWYG HTML editor is best choice. You can always use a simple tool to convert it to PDF, and you can always edit HTML when you need something advanced. Also it's easier to put online when you need.

That's how I'm managing my software documentations and works fine for me.

dr. evil
+3  A: 

After many years of anguish and several false starts, I'm about to revisit this, and I'm going to give Sphinx a try. It can generate HTML or LaTeX from ReStructured Text.

I'm hoping it will be a much "lighter" option than full DocBook, but with many of the advantages.

Brent.Longborough
This is exactly my experience. Our manual was writte in docbook, but it was cumbersome to edit and so we never worked on the manual (and it was pretty ugly anyway). reST and Sphinx are much easier to use (and are much much prettier).
Paul Biggar
+8  A: 

For documenting code, I also recommend Sphinx. ReStructured Text is nice because it is readable and somewhat marked up in plaintext, and can do a nice job converting to html and to pdf. I still like LaTeX for certain things. My wife and I use LaTeX to write our christmas letter, which we mail out via snail mail. The pdf version is pretty fancy, with two columns, and headers and footers. The html version is simpler. I convert with plastex. Examples here: http://fedibblety.com/annualReports

I don't think any binary format is a good choice (Word) for any sort of document that you might like to read 10 years from now. That is one of the nice things about LaTeX.

A: 

If everything else fails you could grab an LaTeX to XML converter and write a simple XSLT stylesheet to convert it to HTML, or create a CSS style sheet and attach it to the XML file directly.

Jasper Bekkers
Interesting. Which latex to xml convetor did you have in mind ?
Marco van de Voort
A: 

We've been using WebWorks ePublisher (www.webworks.com) which offers both multiple single-source formats (we are using Word) and the ability to output to many output formats (we output to Adobe PDF and Online Help (.CHM).