112

Is there any way to produce doc/docx files from LaTeX?

2

7 Answers 7

82

For my (word-loving) Thesis Advisor I always ran the .tex-Files through htlatex (as suggested by chl and Stefan). The resulting HTML-file can then be opened with Word and saved in the desired .doc or .docx Format. Since you've mentioned that you're on Linux, you might not have Word anyways, then you can also send the HTML file to the person doing the revisions, with instructions on how to open a .html and save as revised .doc.

For not too complicated files (not including figures and delicate macros) I also had great results using the awesome pandoc.

And just as a snickering remark: In the long run, it might be good to learn your revisor some LaTeX skills, have some kind of revision system (SVN, Git, etc.) and work on the same repository (but that didn't work out for me either :)

12
  • 5
    +1 for pandoc, you can convert latex straight to odt and the new version has also support for simple latex tables and listings. Feb 11, 2011 at 18:46
  • 5
    Note that you can change the extension of a .html file to .doc so that it opens in Word when you double-click it. Feb 14, 2013 at 8:40
  • I, too, have a need to convert a Tex file to Doc (damned stupid submission rules for certain things); but when passing my Tex files through pandoc, the resultant file only contains section headers. Any ideas what I'm going wrong? Oct 8, 2013 at 8:49
  • 1
    It's an excellent point, but also an extraordinarily optimistic idea to think that my advisor will ever use markup languages. Not to mention version control systems... Nov 26, 2013 at 23:58
  • @sepideh "It's not working" makes helping you nearly impossible. What are the problems you are encountering? With pandoc, LaTeX, Word or OpenOffice?
    – Habi
    Aug 11, 2015 at 12:57
24

I've tried a number of them: latex2rtf, tex4ht, freepdf, AdobeExportPDF, and I used MS Word 2013 to convert from pdf to docx.

latex2rtf is only useful if you use standard math (no amsmath and similar package) and no tables. Basically, you are confined to converting a basic text document.

tex4ht does, in my experience, pretty much the same job as latex2rtf. As soon as you insert a little math and some tables, the result is hardly usable.

freepdf does the job well - but it only converts 2 pdf pages for free. The name is a little misleading.

AdobeExportPDF comes up with the best result but there is no free version.

MSWord2013 is not as polished as freepdf or Adobe's solution. Some tables will be converted to actual tables and others will be converted to png images. The same with equations - they are not converted to actual equations but to the closest symbols and sometimes to png images. Basically, all equations need to be rewritten in word.

After years of trying and frustration I gave up and got myself a yearly license for AdobeExportPDF - which is considerably cheaper compared to freepdf. I know, it's not directly out of latex but at some point that was not an issue for me any more. I simply needed something that does the job quickly and which minimizes my postprocessing. Which, btw., is needed in all of the solutions mentioned above.

2
12

Near acceptable quality conversions can be achieved by producing a "pdf" document via LaTeX and then using Adobe Professional Pro Extended (save as) to convert.

8
  • 1
    Sounds good. Unfortunately, I am on Linux now, and this is why I want this tool (i.e. sending the docx to another person for reviewing and commenting). Anyway, so if you think you have a suggestion of how to exchange comments using LaTeX, then please let me know to open a new question and you could answer it.
    – Rafid
    Jan 12, 2011 at 19:12
  • @Rafid If it is not a long document, why don't you use the minimum LaTeX commands possible and just post is as LaTeX code at latex.pastebin.com or as a google docs document. They are very good for sharing documents (your reviewer can just read the text portion).
    – yannisl
    Jan 12, 2011 at 19:38
  • 1
    @Rafid: If all you want is someone to review and comment, why not just send them the PDF? What's gained by a conversion to Word?
    – TH.
    Jan 12, 2011 at 21:17
  • @Yiannis, I haven't tried latex.pastebin.com, but Google Docs doesn't have reviewing like word.
    – Rafid
    Jan 12, 2011 at 22:25
  • 3
    @TH, Word has good reviewing system. If I send a pdf, that means he (my supervisor) has to copy the line he wants to copy, then insert his comments, which is a tedious task. In word, we simply select a text, and add a comment to it, and word will take care of the remaining.
    – Rafid
    Jan 12, 2011 at 22:26
9

if it is not a secure document you can upload a pdf to freepdf and convert it online. It depends to your document if the result is useful or garbage.

If your document has not a complecated structure than you can also try to convert it with t4ht into html and then read it with word/OpenOffice and saving it as doc.

6
  • That is a good suggestion. The only problem is that it doesn't seem to be working :-) I tried it, and it generated an empty document!
    – Rafid
    Jan 12, 2011 at 19:26
  • There maybe other online converters. An alternative maybe a temporary installation of nitro pdf or TeX2word (you can google the web addresses) but both work only under windows.
    – user2478
    Jan 12, 2011 at 19:33
  • @Herbert: do you mean
    – Stefan Kottwitz
    Jan 12, 2011 at 20:07
  • @Stefan Kottwitz: what??
    – user2478
    Jan 13, 2011 at 15:29
  • 2
    Stefan Kottwitz: sorry, should be t4ht which is a synonym for tex4ht and its home is http://tug.org/applications/tex4ht/mn.html. But Eitan Gurari died in 2009, the reason why it is now not really maintained.
    – user2478
    Jan 13, 2011 at 19:08
7

I would like to resurrect this question. There are actually two separate questions here. First is there a good way to produce .doc file from LaTeX? The answer is probably yes if you work for Microsoft and you can see the source code for the rest of us no because it is binary locked format. The second question is if there is a good way to produce .docx files from LaTeX? Actually I think that correct answer should be yes with little bit work. Namely .docx is just a zipped archive. If you unzip it you will see bunch of XML files. One of them keeps the content the others are essentially style files. My understanding is that most publisher at this time keep permanent documents in XML format. Professional quality converter LaTeX to XML do exist. The real question is how to extract enough information from LaTeX document to populate Microsoft XML style files. If I would have to put my bet that code probably can be written if it is not already written.

1
6

GrindEq makes a wonderful job in many cases. It is a plug-in for MS Word and converts equations, figures, tables, etc.. The bad point is that it is paid, and not open source. Anyway, the evaluation version lets you execute 10 times, and so it requires registration.

3

Independently of the tool you perform the conversion, you can fix the non-satisfactory converted parts with TexSword. For example, I am happy with Latex2rtf + TexSword.

Not the answer you're looking for? Browse other questions tagged .