XML to LaTeX
Apr. 3rd, 2005 11:55 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
One of the problems with documents in XML is that getting print out of them is vaguely irritating. The "standard" way is to use XSLT to convert your input to XSL:FO, and then use a tool like FOP or PassiveTeX to convert that to PS/PDF. The obvious problems are that the stylesheets out there aren't very good (printed DocBook is "just okay" aesthetically) and that the free formatting tools suck.
But TeX is widely available, free, and has a good formatting engine. Why does nobody use XSLT to convert XML to *TeX, and then format that? The impedance mismatch between XML's character set and LaTeX's is slightly irritating, but it's not that hard to work around, even without having EXSLT available. And then if you're familiar with both XML and LaTeX, you can probably copy-and-paste your way to happiness given a stylesheet (also true of XSL:FO, but more people know LaTeX than XSL:FO).
For a proof-of-concept, I did this for my resume (not that I'm job-hunting at all, it's just a simple XML document I have kicking around). It could use some formatting tweaks, but it came out pretty well. Certainly it proves that what I'm trying to do is eminently reasonable, and so it's sane to suggest to other people that if they have data they want to query and include in a LaTeX document that they should store the data in XML and then use XSLT to create document fragments rather than trying to write TeX macros to process the data directly.
But TeX is widely available, free, and has a good formatting engine. Why does nobody use XSLT to convert XML to *TeX, and then format that? The impedance mismatch between XML's character set and LaTeX's is slightly irritating, but it's not that hard to work around, even without having EXSLT available. And then if you're familiar with both XML and LaTeX, you can probably copy-and-paste your way to happiness given a stylesheet (also true of XSL:FO, but more people know LaTeX than XSL:FO).
For a proof-of-concept, I did this for my resume (not that I'm job-hunting at all, it's just a simple XML document I have kicking around). It could use some formatting tweaks, but it came out pretty well. Certainly it proves that what I'm trying to do is eminently reasonable, and so it's sane to suggest to other people that if they have data they want to query and include in a LaTeX document that they should store the data in XML and then use XSLT to create document fragments rather than trying to write TeX macros to process the data directly.