6

I need to produce a RTF/DOC/ODT document from LyX for my supervisors to comment and edit. The Lyx document contains ERT, master/children docs, hyperrefs, cross-references, svg/png figures, and basic equations. The PDF (pdflatex) looks fine.

I tried:

  1. Asking supervisors to comment/edit PDF,
  2. Lyx -> ODT (from the export list),
  3. Lyx -> HTML (Word, from the export list) -> Word,
  4. Lyx -> Tex (from the export list) -> latex2rtf,
  5. Lyx -> Tex (from the export list) -> Tex2word,

all of which produced various errors and/or unsatisfactory rendering of references, graphics, formulas. (From this I can guess that there's probably a problem in my Latex configuration but I don't know where to start to fix it. My understanding of Latex is extremely limited, which is why I chose Lyx in the first place.)

The "close enough" export format that I can manage to get is XHTML, but of course Word won't open it... I'm hitting a wall. I don't need proper page layout as much as I need a proper rendering of figures, references, and formulas (as graphics if need be).

Suggestions?

  • Go for solution 1. Or check all the questions regarding "latex to word" on his site. Search e.g. for "convert latex to word". – Ulrike Fischer May 20 '15 at 9:05
  • Already read a number of posts on this site and others, and already tried solutions 1, 2, 3, 4, and 5. Regarding solution 1, because they are my supervisors I don't have any leverage here so if they say no, it's final. As of now my best result has been with solution (6) Lyx -> XHTML -> copy-paste to Word -> manually insert figures and equations. This is good for now, but not really viable in the long run. – user42174 May 20 '15 at 9:21
  • Well if you alreay read a number of posts you should have realized that the problem is difficult, that there is no clean solution and that it is not a problem of your latex configuration. Beside this I always found it very dubious that supervisors ask for an editable format. – Ulrike Fischer May 20 '15 at 9:30
  • Okay, thanks for your input. The "latex config problem" was because I'm sometimes getting "file not found" errors with Lyx's ODF export, which I read in Lyx Wiki could be due to problems in the Latex config. – user42174 May 20 '15 at 9:40
  • Without more information it is difficult to say what's wrong. But if you are using miktex as texsystem and if lyx is using tex4ht for the odt export: There are some open bugs regarding miktex and tex4ht: E.g. sourceforge.net/p/miktex/bugs/2350 and sourceforge.net/p/miktex/bugs/2322 – Ulrike Fischer May 20 '15 at 10:23
1

I do not recommend it, but in LyX 2.2.0 there will be an option (if you have the dependencies installed) to export through Pandoc: http://wiki.lyx.org/LyX.NewInLyX22#converters

  • 1
    The LyX export to OpenDocument and MS Word Office XML using Pandoc works pretty well out of the box. See latex-community.org/forum/viewtopic.php?f=19&t=27764 to add bibliography support as well. Master-child is handled within LyX so should be fine. Cross-referencing is not handled, you just get the labels. Equations are in principle supported, but I don't know how well. I doubt it can handle all the graphics and ERT. I think that's at least as good as latex2rtf, and easier to install on some systems. htlatex renders the tex codes as images, which is unworkable except for display. – Julien Dutant Aug 27 '16 at 17:00
  • @JulienDutant thanks for an update on the current state of affairs. I'm glad that the export to Pandoc is working well. – scottkosty Aug 27 '16 at 17:06
  • 1
    The Pandoc export how-to is now on the LyX wiki: wiki.lyx.org/Tips/…. – Julien Dutant Aug 29 '16 at 13:00
  • @JulienDutant great. Thanks for doing that! – scottkosty Aug 29 '16 at 15:58
2

Here's the procedure that I followed after many trials. It's a little cumbersome and far from perfect. I thought it was worth sharing because it got me to a better home than any other: it allowed at least not to replace all special characters in my Italian document, which was the show stopper for me in using latex2rtf (a).

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

I had to manually reinsert the images (c), but it felt like a gift when compared with all other methods I tried. I gladly took that task of copying and pasting a few images from the nice Lyx-Pdf output into LibreOffice. My counterpart had Word, and saving the document as .doc or docx gave good results.

(a) A little additional comment on latex2rtf: if you can run your conversion with the standard charset, or with one of the alternatives provided changing its options, it can get you some support. I noticed that it would not work with the adjustbox toolkit, so you would have to remove pieces of code used to center your images in pdf, it supports tikz only to a limited extent (it seemed to like a matrix of nodes, not the simpler node list). It can import images, but apparently only with no space in their names. All in all it can work for quite a few users. (b) I suspect I got the package by installing the gigantic latex2rtf application, but it should be an easy find. (c) On that matter I have a feeling that the Lyx export of images into Latex and then html should work, so there's probably room for improvement if you are a more experienced user than myself.

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Martin Schröder Oct 8 '15 at 22:26
  • Thanks. It's pretty close to the method I ended up using quite extensively, which was Lyx => LyxHTML => copy-paste to Word keeping the formatting => add graphics manually. Of course it's far from perfect but it worked well enough for my purposes :) – user42174 Oct 9 '15 at 21:53
  • Ah, excellent. I had tried that one, but was not working for my document. Maybe it was a little too complex or confused: it was my first work with Lyx and I added a few libraries to get to the result. My impression is that the more libraries you add, the most complex it gets for converters to execute properly. Did you open the LyxHTML with Firefox or another browser? – Giampaolo Ferradini Oct 13 '15 at 10:46
  • you're right i think i was opening it in firefox... (if i remember correctly, i think the formatting was rendered differently in chrome for some obscure reason) – user42174 Dec 9 '15 at 16:48
1

The best way to achieve this, at least, what I have figured out is this: from LyX export as ODT using elyxer. It manages text very well. But you have to manually insert the images in the proper place in ODT document. You can export the document as HTML that will create a folder with all the figures. It will be easy to insert figures from that folder as replace image in Libre Office. The final product looks satisfactory. It might work for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.