PDF and HTML from the same LaTeX source, a minimal example

PDF and HTML from the same LaTeX source, a minimal example

by Visvanath Ratnaweera -
Number of replies: 3
Picture of Particularly helpful Moodlers Picture of Translators
Maintaining two different versions of the same teaching material, one made for paper and the other for the computer screen, is a hassle. Fortunately there are decent "filters" which create acceptable HTML "mini-sites" out of LaTeX source. This document explains one such method using TeXht http://www.tug.org/applications/tex4ht/ as the LaTeX to XHTML filter through a minimal example.

Here is the result for paper: http://scratch.syndrega.com/sampledoc.pdf

Here is the resulting XHTML "mini-site": http://scratch.syndrega.com/sampledoc.html

This is the LaTeX source: http://scratch.syndrega.com/sampledoc.tex

To create the PDF go 'latex sampledoc.tex; dvips sampledoc.dvi; ps2pdf sampledoc.ps'.

To create the HTML run 'htlatex sampledoc.tex "xhtml,2,info"'.

This is how the resutling "mini-site" appears on Moodle: http://scratch.syndrega.com/mdl27/course/view.php?id=3 (guest log in) then activity "Sample doc".

All these files compressed to a single file: http://scratch.syndrega.com/sampledoc.zip.

Please note that those files will be updated or deleted at any time!

If anything is unclear, just ask!
Average of ratings: -
In reply to Visvanath Ratnaweera

Re: PDF and HTML from the same LaTeX source, a minimal example

by Colin Fraser -
Picture of Documentation writers Picture of Testers

What a great idea, pity the image quality for the HTML files is not that good, but I think it is likely to improve as the technology does. Thanks for this...big grin

In reply to Colin Fraser

Re: PDF and HTML from the same LaTeX source, a minimal example

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Colin

Thanks for the hint. I never use pictures (JPEG, PNG) of this kind of documents, therefore not noticed. The quality loss happened during the conversion from PNG to EPS. You can compare 04068.png and 04068.eps in the ZIP. In my environment I can only include EPS pictures. May be other LaTeX users can give me a solution.

It is important that I take the tex -> dvi -> ps -> pdf path (as opposed to pdflatex, PGF/TikZ) because of the PSTricks and PostScript symbol libraries I use.