I'm trying to turn my latex document into an odt file to be able to open it with LibreOffice (to then be able and save it as MS Word file so colleagues can open and comment on it). Although the file is quite complicated I get it more or less to the same stage as a very basic latex document, such as:

    Lorem ipsum

I normally use Texmaker as Editor, MikTeX 2.9, on Windows 7. Usually I use pdflatex, but have also run latex before to preproduce divs. Texmaker has an "Export using tex4ht" option (which fails because it cannot find "ooffice/!.lg"), so I tried using the command lines

D:\test>htlatex test.tex

which produces the desired html file (after some initial hickups).

When I run

D:\test>mk4ht oolatex test.tex

it produces an odt. However, when I want to open the odt, I get an error message which translates to

Read-Error. Format Error discovered in the file in sub-document styles.xml at 2,2568(row,col)

(note, the numbers are made up)

I have extracted the odt with 7zip, but I don't understand anything in the styles.xml file (and I don't know how to find that exact location anyways). The location error varies for different *.tex input files (maybe due to their different size?). Also, there is no content.xml, so I suspect something is not working right.

Can anybody help? Any hints (or solutions) would be greatly appreciated.

  • The pathes in tex4ht.env for the java classes are (still) faulty. There are a bit different now then in this bug report sourceforge.net/p/miktex/bugs/2322 but wrong nevertheless. It doesn't help much to change tex4ht.env as miktex then tries to "repair" at the next update. As long as the bug is not resolved you should better use texlive. – Ulrike Fischer Jan 28 '16 at 17:54
  • pandoc -o output.odt input.tex, but I it is doubt of the utility this conversion of "quite complicated files" respect of detex input.tex > ouput.txt (unless the .odt file should be the final document). – Fran Feb 3 '16 at 11:54

As of today, running

  • mk4ht (Version 1.1)
  • LibreOffice 430m0(Build:2)

which are the version provided with my Debian installation, and testing your basics document

    Lorem ipsum

the command mk4ht oolatex test.tex produces an odt document that I can perfectly open with LibreOffice.

Have you tried to update your softwares?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.