[texhax] ODT to TeX

Niall Mansfield texhax at uit.co.uk
Wed Jul 9 13:07:34 CEST 2008

   > Date: Tue, 08 Jul 2008 07:44:52 -0700
   > From: Pierre MacKay <pierre.mackay at comcast.net>
   > ...
   > OpenOffice.org already has a Latex converter built-in.

The in-built converter that OpenOffice uses is Writer2LaTeX.
You get also get it standalone at:
which is what we did.  It will probably be a more recent version, and
you can run it standalone and incorporate it into scripts -- always a
Good Thing.

Overall, we found Writer2LaTeX wonderful.

   > That is a sort of good news, but most of these converters strive very
   > hard to retain the formatting of the ODT document, which is not, in this
   > instance, what is needed.

Writer2LaTeX is customizable, so you can specify a lot of information
about how the content is to be converted.  There are several
"standard" configs you can use, ranging from "as faithful as possible"
to "semantic only" conversions.

There was a lot of rubbish in the ODT doc that we didn't want, and
quick configuration of Writer2LaTeX (below, based on the "ultraclean"
standard config) removed most of it, so that what was left could be
quickly cleaned up with scripts and a few Emacs keystrokes.


<?xml version="1.0" encoding="UTF-8"?>
<!-- based on ultraclean.xml NMM  6-Feb-2008  -->

   <option name="documentclass" value="book" />
   <option name="backend" value="generic" />
   <option name="inputencoding" value="ascii" />
   <option name="multilingual" value="false" />
   <option name="use_ooomath" value="false" />
   <option name="use_color" value="true" />
   <option name="use_colortbl" value="false" />
   <option name="use_hyperref" value="false" />
   <option name="use_bibtex" value="false" />
   <option name="bibtex_style" value="plain" />
   <option name="formatting" value="ignore_most" />
   <option name="page_formatting" value="ignore_all" />
   <option name="ignore_empty_paragraphs" value="true" />
   <option name="ignore_hard_page_breaks" value="false" />
   <option name="ignore_hard_line_breaks" value="false" />
   <option name="ignore_double_spaces" value="true" />
   <style-map name="Preformatted Text" class="paragraph-block" next="Preformatted Text" 
before="\begin{verbatim}" after="\end{verbatim}" />
   <style-map name="Preformatted Text" class="paragraph" before="" after="" verbatim="true" />
   <style-map name="Preformatted updated" class="paragraph-block" next="Preformatted Text" 
before="\begin{verbatim}" after="\end{verbatim}" />
   <style-map name="Preformatted updated" class="paragraph" before="" after="" verbatim="true" />
   <heading-map max-level="5">
     <heading-level-map writer-level="1" name="chapter" level="1" />
     <heading-level-map writer-level="2" name="section" level="2" />
     <heading-level-map writer-level="3" name="subsection" level="3" />
     <heading-level-map writer-level="4" name="subsubsection" level="4" />
     <heading-level-map writer-level="5" name="paragraph" level="5" />
   <custom-preamble />

More information about the texhax mailing list