11

How do you convert Open Office (ODT) documents to tex files? I have made a report using libre office. Now I wish to continue editing the document using lyx (latex front end). So the ODT file needs to be saved as some .tex file.

I don't see an option to do this in File menu (export/save as). So is there any other plugin to do this?

slhck
  • 223,558
  • 70
  • 607
  • 592
AIB
  • 541
  • 2
  • 8
  • 20

2 Answers2

11

OpenOffice used to have a LaTeX export functionality, which was later removed, I guess. Nevertheless, there is a LaTeX writer:

sudo apt-get install openoffice.org-writer2latex writer2latex

Or, if your distribution uses LibreOffice, use libreoffice-writer2latex instead of the above.

Just confirm all messages with y. After installing, you can use it with w2l

w2l your-document.odt

which will create a .tex file with the same name. The formatting is pretty basic, but I think it gets the job done.

If you wish to edit it in Lyx after that, just concatenate the commands, something like that:

w2l your-document.odt && /usr/bin/env lyx your-document.tex &

I tested the conversion on Ubuntu 11.04 with the default LibreOffice installation

slhck
  • 223,558
  • 70
  • 607
  • 592
  • The package is now called libreoffice-writer2latex, at least in fedora. – Bianca Jan 24 '13 at 09:33
  • On Debian Squeeze, the package seems to be called `writer2latex`. At least, that package provides a `w2l` that does the job. – user Feb 12 '13 at 13:49
1

Libreoffice has a writer2latex extension that you can load simply by double-clicking on the .oxt file or by getting the package from apt ( I assume also yum )

Link to extension: http://writer2latex.sourceforge.net/index14.html

Once you install the extension, you can use File->Export to .tex.

But:

  • I was unable to get Libreoffice 4.0x to run the extension against a complex document.

  • LO 3.4.4 ran the extension just fine, but lost almost all formatting, lost all tables and pictures.

Bottom Line:

I gave up. You'd be better off just exporting to text, and starting over. It appears to me as a complete NOOB to Lyx and Latex, that many document settings don't have an equivalent, and simply can't be translated. However I'd be delighted to be shown that I am wrong.

John P. Fisher
  • 245
  • 3
  • 8