Ubuntu – How to convert .tex into .odt


I wish to convert a .tex file into an .odt file.
Can you suggest a good step-by-step solution?

Best Answer

Believe it or not, with complex documents and lots of packages included, I got much better results with LaTeX2HTML than with LaTeX2RTF, Pandoc or TeX4ht.

latex2html texfile.tex -split 0 -no_navigation -info "" -address "" -html_version 4.0,unicode

This will generate a folder with the same texfile name, so you'll be able to convert the generated HTML to ODT:

libreoffice --headless --convert-to odt:"OpenDocument Text Flat XML" texfile/index.html

This will produce a index.odt file. Take a look at this answer to check how to use LibreOffice's convert filters.

Edit from comment discussion:

Although the method above works, it is very disappointing that the only way I found to generate a trully reliable document is using the PDF output from LaTeX on Adobe Acrobat Pro.