Converting Open Office (odt) files to Latex

10

6

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?

AIB

Posted 2011-05-25T09:11:31.597

Reputation: 521

Answers

10

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

Posted 2011-05-25T09:11:31.597

Reputation: 182 472

The package is now called libreoffice-writer2latex, at least in fedora. – Harpy – 2013-01-24T09:33:54.393

On Debian Squeeze, the package seems to be called writer2latex. At least, that package provides a w2l that does the job. – a CVn – 2013-02-12T13:49:11.353

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

Posted 2011-05-25T09:11:31.597

Reputation: 173