Is there a good higher-level language or tex environment that would facilate both HTML and PDF rendering? I would like to be able to write tex document and on the basis of this document create mathjax-compliant HMTL and nicely-formatted PDF. This approach would also need to handle, for example, producing multiple HTML documents but creating a single PDF that would encapsulate the same content. Is there a good way to do this?
|
|
If you are just a little familiar with python, or not scared by it, I suggest sphinx. Their website links to many examples, there are relatively many extensions available and because it is the official Python documentation system (and by consequence of many python-related projects), you have a good guarantee that it survives long. For math, there are currently 2 systems, |
|||||||||
|
|
I heartily agree with N.N.'s comment. You can write in markdown and then export to LaTeX (and then into PDF) and into HTML, DocBook, and a number of other formats using Pandoc. It's a really neat system. And for more fancy websites, there's yst, also from John MacFarlane, the author of Pandoc. It allows you to keep your data structured in |
|||||||
|
|
There is also AsciiDoc, which can be translated into many different file formats. I've never used pandoc though, so I cannot tell which one to use. |
|||
|
|
I produce multiple formats (pdf slides, pdf notes, html text) from the same source; the contents also varies depending on the format. The input has no math. At first I tried pandoc, which is great if you have little or no structure in your text. Pandoc produces well formed HTML and well formed LaTeX/ConTeXt output. It also supports gazillion other output formats, so you get epub, docbook, etc for free. The only drawback of pandoc is that markdown is a very limited input format. Markdown tags are style tags ( Next I tried using ConTeXt. I can use all the structure tags that I want in my input and it is easy to generate multiple versions of the same document. ConTeXt also provides an XML/XHTML export. I used CSS to directly display the xml. Everything worked flawlessly at the TeX->PDF route, but I am not completely happy with the XHTML output. Part of the reason is that I was trying to display the output directly using CSS and, as such, was limited by what is allowed in CSS. In hind sight, I think that it would have been better to use XSLT to convert (the ConTeXt generated) XML to HTML. I do not have much experience in using XSLT, but after playing around it with a while I think that rather than trying to convert ConTeXt generated XML to HTML, it is better to start with hand-written XML and convert it to HTML. Once I thought about it a bit, I realized that there is not much difference between tex input (at least, ConTeXt input) and XML input. In ConTeXt, all commands have a
becomes
and so on. The same is true for inline commands. So, next year, I am planning to start with hand-written XML input and use XSLT (or some other XML->HTML tool) to convert it to HTML and use ConTeXt to directly process it to PDF. The main advantage of this approach is that the structure of my input is almost exactly same as my tex input, and I get good PDF output with very little effort. The HTML output requires a bit of work (for me), because I am not familiar with the XML->HTML toolchain, but I am confident that there will be good tools there. TL;DR Pandoc: Great output, limited input features. ConTeXt: Great input markup, great pdf output, you need to use XSLT to tweak XML output. XML: Flexible input markup, use ConTeXt (or LaTeX) to directly produce PDF, use XSLT (or some other tool) to generate HTML. |
||||
|
|
