Word – Converting a Lyx document to MS Word

latexlyxmicrosoft wordrtf

I've made several attempts of converting a Lyx document to MS Word , or RTF, and failed. I'm working with a moderately complex document, involving external includes ( Java code, Child documents ), formulas and images.

I've tried

  • exporting to Latex and then using tex4ht but the OpenOffice file is not created ( no context.xml inside the odt );
  • exporting to HTML and importing in OpenOffice Writer;
  • exporting to PDF and importing using Nitro PDF;

I'm now manually converting the Nitro PDF output, but it fares rather badly on formulas and code listings.

What other options are there?

Best Answer

Probably a little late to the party, but since it took me a long while to complete the task even as of today, I felt like it's worth leaving a trace.

Here's the procedure that got me home. It's a little cumbersome, yet it allowed me not to replace all special characters in my Italian document, which was were latex2rtf was failing.

  1. From Lyx, export your file in Latex(Luatex, didn't try the other options)
  2. Run htlatex [filename.tex] (a)
  3. Open the resulting file with Firefox, it should show all of your formattings rather well
  4. Select All-->Copy-->Paste into LibreOffice

I had to manually reinsert the images (b), but it felt like a gift when compared with all other methods I tried. Sorry I didn't test further refinements, but had to complete everything to comply with a tight deadline and hadn't had time to test afterwards. Will edit if able to.

(a) I suspect I got the package by installing the gigantic latex2rtf application, but it should be an easy find. (b) On that matter I suspect the Lyx export of images into Latex would have worked if the images didn't contain spaces in their filenames, but can't confirm yet. Might check and edit this little bit. Edit: checked (b), and I could not make it work. The spaces trick applies to latex2rtf.

Related Question