# How do I convert Open Office documents into LaTeX?

Is there a good utility for this? Does it more than the standard stuff, or does it also do formulas and poems etc. in a good way?

-

You could use Writer2LaTeX:

Perhaps have a look at alternative ways: Converters from PC Textprocessors to LaTeX

-

LibreOffice Writer, as one would expect, also includes Writer2LaTeX as an extension.

Writer2LaTeX is being actively developed (the current stable version is 1.0.2 (included with Ubuntu Natty, for example), the latest development alpha is 1.1.8. Changes include the development of Writer4LaTeX, aiming to integrate Writer with a LaTeX installation, providing a 'LaTeX' menu item on the LibreOffice Writer menu bar, effectively providing (by default) latex (usually symlinked to pdflatex) as a typesetting engine for Writer accessible directly on the Writer menu. The options for the extensions can be set from within Writer.

The range of export options for Writer2LaTeX (Writer extension) and w2l (command line Writer2LaTeX) is extensive and detailed in the software's manual. At the top level Writer2LaTeX allows the selection of export options that range from an ultra-lean document (not much more than content) to keeping the screen appearance (in a .pdf), and allows custom configuration of options. The documentation covers this so I'll not put more here beyond this quotation:

1.2 More about Writer2LaTeX and Writer2BibTeX

Writer2LaTeX is quite flexible: It can take advantage of several LaTeX packages, such as hyperref, pifont, ulem. It can create customized LaTeX code based on the styles and text in the document. Also it supports more than 25 different languages, latin, greek and cyrillic scripts and 8 input-encodings. The flexibility makes it possible to use Writer2LaTeX from several philosophies:

You can use LaTeX as a typesetting engine for your OOo documents: Writer2LaTeX can be configured to create a LaTeX document with as much formatting as possible preserved. Note that the resulting LaTeX source will be readable, but not very clean. Be aware that even though Writer2LaTeX tries hard to cope with any document, you will only get good results for well structured documents, ie. documents that are formatted using styles. For other documents you will find that Writer2LaTeX uses the principle garbage in – garbage out!

If you need to continue the work on your document in LaTeX your primary interest may be the content rather than the formatting. Writer2LaTeX can instructed to produce a LaTeX document which strips most of the formatting and hence produces a clean LaTeX source from any source document.

Traditionally, LaTeX documents are written by hand using a text editor. Using a graphical frontend like LyX provides a more user friendly alternative. A companion extension named Writer4LaTeX is in available and provides the tools to make you use OOo as a graphical frontend for LaTeX.

If it may be of interest, visit the Writer2LaTeX project site, browse the documentation and perhaps give the software a try with copies of your documents. (If you have Ubuntu Natty then the v1.0.2 software and manual can be installed using Synaptic and the manual should then be at /usr/share/doc/writer2latex/manual/user-manual.odt).

I have used v1.0.2 for exporting several documents to aid with transitioning workflows from word processor or DTP software to TeX and friends. In general I have wanted good content conversion and some limited structure conversion and have had less interest in preserving the look of the document. My documents have generally been simple but the conversion has been helpful and, where the document was well structured (e.g. styles used) then this has been mostly preserved -- at least enough to provide suggestions for LaTeX commands and packages. The only notable exception was multiple columns were lost but I did not try changing options to achieve that: for my use it was easier to take the content and apply appropriate LaTeX commands to provide a suitable structure. This also applies to formulae. As an example, if Einstein's famous equation is entered as text (using a superscript) and then with the Writer equation editor the resulting .tex file, (created via Writer4LaTeX and Writer2Latex (v1.1.8) within LibreOffice Writer) contains:

\begin{document}
e = mc\textsuperscript{2}

$e=mc^{2}$
\end{document}


There is useful discussion of file conversion to LaTeX in the question adding Word files to documents, including some helpful links to other tools and links to detailed consideration of their (de-)merits.

-