I know that XMLTeX has already been used to typeset TEI documents, but has anyone publicly worked on a set of environment files and stylesheets to typeset OpenDocument Text? I have been looking for such things lately, but I could not find anything.

The rationale is that I want a comprehensive solution for typesetting ODT documents produced by OpenOffice and LibreOffice without having to rely on XSLT. Writer2LateX does a great job in some situations, but for more consistency and efficiency I deem it eminently desirable to be able to define the style of an ODT document directly in TeX and then apply this style to a set of documents that have the same structure and use the same styles.

Writer2LaTeX uses Java, XSLT and components from the OpenOffice SDK to produce a relatively faithful LaTeX document from the provided ODT; this means that every time the source ODT is modified, a new LaTeX document must be produced from it, with all content and all styles converted each time. What is more, Writer2LaTeX must more or less “reinvent the wheel” each time it is given a new paragraph, character or list style, resulting in environment and command definitions which are extremely verbose. It would be great to instead create concise and generic environment definitions for each ODT element and then create more detailed definitions for each style attribute.

Am I making sense? I am aware of the fact that what I am asking for is huge. After all, to get the expected results, one would have to provide definitions for all the elements of all the relevant XML namespaces (a typical ODT file has many besides the standard ODF 1.2 namespaces). However, if someone provided those generic element definitions “once and for all”, then the person who is in charge of typesetting a given document could concentrate on defining environments for the particular styles encountered in the particular document.

  • 5
    ooh xmltex:-) If I was doing this I'd use XSLT, it really is a lot easier to get XSLT to handle the XML re-arrangement and write out some tex rather than get TeX to do it at the same time. Commented Mar 20, 2013 at 16:31
  • 2
    I haven't looked at their XSLT, but that's where I'd start. Commented Mar 20, 2013 at 18:25
  • 6
    Seriously: Forget about XMLTeX and use ConTeXt instead. Or use pandoc. Commented Mar 21, 2013 at 12:45
  • 4
    See ConTeXt wiki article on typesetting TEI to get an idea of how to typeset xml using context
    – Aditya
    Commented Aug 19, 2013 at 15:26
  • 4
    Author of the two documents on ConTeXt here. I often go this route: LibreOffice document – xml representation – pdf typeset with ConTeXt. However, all my attempts to use the odf file directly have been unsuccessful; I've found the xml unpredictable and inconsistent across documents. So I usually export the document to xhtml, do a little clean up and then typeset this simpler xml document. May not be what you want to hear, but IMHO, a complete definition of the entire odf xml is not just huge, it's unrealistic.
    – Thomas
    Commented Dec 2, 2016 at 7:10


You must log in to answer this question.

Browse other questions tagged .