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

  • 3
    @Naruto: I assume it's a LaTeX document. Commented Nov 25, 2011 at 20:33
  • 4
    Note that for all answers below: your success rate will depend on the latex packages used, and math will never be typeset as nicely as in latex. Commented Nov 26, 2011 at 3:03

5 Answers 5


There is a tool in the repositories that changes LaTeX to openoffice.org's XML format: tex4ht Install tex4ht

TeX4ht is a highly configurable TeX-based authoring system for producing hypertext. It interacts with TeX-based applications through style files and postprocessors, leaving the processing of the source files to the native TeX compiler. Consequently, TeX4ht can handle the features of TeX-based systems in general, and of LaTeX in particular.

TeX4ht can be used both for authoring HTML using TeX/LaTeX input files, or for converting existing TeX input files (in any format) into HTML, with (usually) only minor modifications. Other varieties of hypertext can also be produced, including XML, XHTML, MathML and the Openoffice.org format of XML.

Command line...

  1. latex filename.tex
  2. bibtex filename.aux
  3. mk4ht oolatex filename.tex

Should end up with an openoffice.org/libreoffice compatible file.

  • 2
    Thank you. BTW, it appears the main maintainer of the package has sadly died two years ago.
    – Tal Galili
    Commented Nov 25, 2011 at 19:27
  • 2
    damn that's a pity :(
    – Rinzwind
    Commented Nov 25, 2011 at 19:47
  • I agree - I wish a more active community would have taken upon itself to continue this work...
    – Tal Galili
    Commented Nov 27, 2011 at 2:57
  • +1 for command line example. I did not have time to read the documentation, but the example above is quite easy to follow.
    – antmw1361
    Commented Jun 5, 2013 at 13:39
  • Doesn't work with pagebreaks.
    – Hi-Angel
    Commented Jul 26, 2015 at 10:05

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.

  • 1
    For complex documents with lots of additional packages, files and commands LaTeX2HTML fails. I'm trying to convert my thesis to HTML and than to ODT in order to give it to someone for comments and correction, who is not familiar with LaTeX. Even without custom commands this tool fails. Tikz package for some reason is one of the main culprits. Commented Jul 18, 2014 at 8:10
  • There's no ideal solution @rbaleksandar, specially depending of the packages you're using. I would suggest Pandoc for you. It won't keep all formats, but it is capable of ignoring some structures and build a final document, at least. Commented Jul 18, 2014 at 11:28
  • Doesn't work with pagebreaks.
    – Hi-Angel
    Commented Jul 26, 2015 at 17:40
  • Documents are never perfect with the presented solutions in this question. It is very disappointing that the only way I found to generate a perfect document is using the PDF output from LaTeX with Adobe Acrobat Pro. Commented Aug 6, 2015 at 22:50
  • This command gave me nonsense HTML, and nonsense ODT. Pandoc was much better.
    – jdpipe
    Commented Jul 2, 2018 at 3:01

Another solution is provided from the package pandoc Install pandoc

As an example, you can do:

pandoc -f latex -t odt -o output.odt input.tex

If the input file is latin1 encoded, like my tex files, the solution is:

iconv -f ISO-8859-1 input.tex | pandoc -f latex -t odt -o output.odt

I report part of the description of the package:

Pandoc is a Haskell library for converting from one markup format to another, and a command-line tool that uses this library. It can read

  • markdown and
  • subsets of
    • reStructuredText,
    • HTML, and
    • LaTeX

and it can write

  • plain text,
  • markdown,
  • reStructuredText,
  • HTML, -LaTeX, -ConTeXt,
  • RTF,
  • DocBook XML,
  • OpenDocument XML,
  • ODT,
  • GNU Texinfo,
  • MediaWiki markup,
  • EPUB,
  • Textile,
  • groff man pages,
  • Emacs Org-mode, and
  • Slidy or
  • S5 HTML slide shows.
  • At least version doesn't work with pagebreaks.
    – Hi-Angel
    Commented Jul 26, 2015 at 9:57
  • This one worked pretty well for me... I got figures, headings but no bibliography, and variously mixed-up equations/symbols. But at least I quickly got some text that I could start cleaning up manually.
    – jdpipe
    Commented Jul 2, 2018 at 2:58

It can be done in 2-steps. Go to http://latex2rtf.sourceforge.net/ and use the tools provided to convert first from Latex to RTF and then from RTF to ODT.

Hope it helps.

  • Doesn't work at all 😂 With the minimal example it was hanging for a minute with 100% CPU usage. I don't think it would ever end the work, so I interrupted it.
    – Hi-Angel
    Commented Jul 26, 2015 at 10:15
  • Okay, I managed it to work — perhaps it doesn't work well with macros — and found that it also doesn't e.g. work with a table of contents. So no, not an option.
    – Hi-Angel
    Commented Jul 26, 2015 at 17:29

If you've the tex4ht Install tex4ht package installed, the command oolatex filename converts the .tex into .odt (for more on tex4ht, see here).

Another way would be the latex2rtf Install latex2rtf package, using RTF as intermediate format.

  • oh - sorry, haven't seen the other replies...
    – tohuwawohu
    Commented Nov 25, 2011 at 16:57
  • Not a problem since you added a link to latex2rtf and that was not in any of the other 2 answers ;)
    – Rinzwind
    Commented Nov 25, 2011 at 16:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .