Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I often have to write up reports based on the analysis of some data. I use R to analyse the data and export tables, figures, and text. This is then included into a LaTeX document either using input or Sweave (see here for details).

However, when I collaborate with others, I sometimes need to provide a document in Open Office / MS Word format.

Question:

Thus, assume the simplest scenario

  • I have a LaTeX document with text, tables, and figures
  • I need to export this reliably into Open Office or MS Word format: this includes mathematical formulas, table formatting, and quality figures)
  • I don't need to go back from MS Word to LaTeX

What is a reliable, efficient, and preferably free process?

Initial Thoughts:

I was hoping that there is an expert out there who has worked out a good system already.

share|improve this question
61  
In an ideal world the workflow would be "1) tell your collaborators to use LaTeX 2) live happily ever after" –  Seamus Oct 15 '10 at 10:43
    
There are already 4 answers here: the bounty implies that none are what you are after. Could you elaborate a bit on what is needed beyond what's already been said? –  Joseph Wright Oct 24 '10 at 20:24
4  
@Jeromy a comparative assessment of some of the options is given here –  Seamus Jan 26 '11 at 16:04
4  
Try htlatex with the following command line: htlatex main.tex "html,word" 'symbol/!' "-cvalidate" and see if this gets you started. Look for a file main.html, Word should be able to load it. –  krlmlr Apr 3 '12 at 13:56
1  
Thanks! I have to say that haven't used DOS since 1995 or something (I have a Window 7 machine at work). I found the folder with my tex file in Explorer, shift + right clicked it and clicked "Open command window here". Then I pasted in the code you provided (chanced the file name of course). The result is much better than in my earlier trials. One rather basic document is translated to MS Word document rather well. However, the command doesn't like title pages nor it seems to like my Sweave created tex files. This might be sufficient for a ms, but I am still looking for the perfect solution... –  Mikko Apr 3 '12 at 14:49
show 5 more comments

14 Answers

I think that LaTeX is the wrong starting format, especially if you are generating your input file using Sweave. Instead you can consider using a light-weight markup (Markdown, RST, etc) as a starting format. It will be much easier to convert these formats to both LaTeX and OpenOffice (for example, using Pandoc). As an example, see this sweave file which is written in Markdown. I processed it using sweave, did a bit of post-processing, and then used Pandoc to convert it into ConTeXt. Since the file after post-processing is completely in Markdown format, converting it to OpenOffice should not be a problem.

share|improve this answer
10  
I guess the issue is that LaTeX provides so much desired functionality around equations, bibliographies, cross referencing, and so on, that I don't believe are provided by most other markup languages, and certainly not markdown. –  Jeromy Anglim Apr 3 '12 at 11:38
2  
@JeromyAnglim: the Markdown that Pandoc uses is extended and perhaps better called Pandoc’s Markdown. –  morbusg Apr 3 '12 at 12:30
    
What would you recommend as a starting format using Pandoc? Markdown? –  Manuel Kuehner Mar 12 at 8:19
add comment

I've been implementing this for my lab. We produce several hundred (if not thousand) documents per year. The OP was right in that a well-defined workflow is essential.

Process

For us, the solution was a well-defined process that goes approximately like this:

  1. Define a class file that contains the correct formatting, etc, using article, report or book classes. Include the minimum number of up-to-date packages in the class and add the nag package to make sure that you (and other users) can see that those packages are not deprecated.
  2. Create a template showing how to use the class file
  3. Create an SVN (or git, or whatever) repository for the class and template files, and distribute the URL of the repository to LaTeX users
  4. Create documents using the lab-standard class file on local or network drives, or using collaborative tools like writeLaTeX
  5. Convert the tex files to rtf using LaTeX2rtf, available at http://latex2rtf.sourceforge.net
  6. Get edits and peer reviews done on a cleaned-up .rtf file that has been saved as .doc or .docx
  7. Transfer edits from the .doc or .docx document back in to 'tex manually, and complete the PDF production in LaTeX.
  8. Tagging the document using Adobe Acrobat to satisfy ADA section 508 (accessibility)

Challenges

There were a couple of challenges we had to face to get this adpoted.

  1. Getting the editors and reviewers something that fit with their existing process, hence the use of .rtf and .doc/*.docx* formats
  2. Figuring out how to get the same class file to all users, hence the SVN repository
  3. Making sure people know how to use it, hence the template
  4. Figuring out tools that let people collaborate. But that's a whole other post!

508 Compliance

The one thing that is still causing trouble is 508-compliance. I am looking at the use of the pdfcomment package to add tooltips and the [accessibility][3] package so that documents pass automated testing.

Repository

I've put a demo document in a repository at https://github.com/AndyClifton/AccessibleMetaClass which may be helpful.

share|improve this answer
    
Nice answer - although I'm not sure it effectively goes beyond @frabjous's answer-mention of latex2rtf, which would be the real meat of the answer here. –  Sean Allred Apr 18 '13 at 16:40
    
Thanks. I thought the OP's request for "... a reliable, efficient, and preferably free process" hadn't been answered, which is what I tried to contribute. –  Andy Clifton Apr 18 '13 at 17:03
    
No worries! That's exactly the idea on any SE site. Answer what (you think, but maybe ask comments for clarification) was asked, and especially on questions like this (since everyone has their own workflow, may the best one float to the top :)). –  Sean Allred Apr 18 '13 at 17:06
    
latex2rtf generates 15 blank pages for my document :-( –  gerrit Feb 4 at 16:10
add comment

I think these two softwares are missing in the list.

  1. TeX2Word from Chikriilab

  2. LaTeX-to-Word from Grindeq

Both of them work elegantly for a properly written LaTeX file. Also, they offer packages for word to LaTeX conversion which are again excellent. But unfortunately both of them are not free.

share|improve this answer
add comment

My first instinct would probably be oolatex too, or some other technique using TeX4ht, but another method that can also work well is latex2rtf, though I've had the best luck when I tell it it convert formulas, tables, and other complicated stuff to embedded images in the result: obviously, this isn't a great option if the people you're sending them to need to be able to edit those formulas, etc. (But fine if they only need to read and comment.)

share|improve this answer
1  
Thanks. Formulas might not be a big deal, but images of tables would be a problem. Collaborators often want to customise table formatting based on the look of some final document. –  Jeromy Anglim Oct 15 '10 at 6:31
    
You can convert it with tables as text. I don't use a lot of tables in my field, so I can't really remember how well they convert if you leave them as text. Try for yourself. –  frabjous Oct 15 '10 at 12:27
    
I do believe there is a blog post that is super relevant to this question that you might want to mention... –  Seamus Jan 26 '11 at 13:14
    
@Seamus, this answer is from October, months before I wrote said post. But if I must: Converting Documents from LaTeX to Other Formats –  frabjous Jan 26 '11 at 17:53
    
@frabjous I believe the link you posted is broken, but referenced in another comment below. –  arbolitoloco Jul 7 at 22:56
add comment

There is no pain-free way to do this. Really.

Convert your beautiful TeX to pdf, run pdftotext and then import the plain text into a word processor. Recreate all of the tables and equations by hand. Waste days of your life in order to be "compatible" with chumps who don't care about typography until, finally, you decide to stop working with them. Only then will you find inner peace.

share|improve this answer
15  
chumps who don't care about typography &c. - I realise this is tongue in cheek, but the tone here is condescending Unix user, and I think the site would be better if we avoided it. –  Charles Stewart Oct 24 '10 at 21:23
    
unfortunately many people use word, so for reviewing documents there is little choice. –  celenius Dec 5 '11 at 17:47
    
Have you tried dvitty instead of the two-step pdftex and then pdftotext approach? –  Jim Hefferon Sep 5 '13 at 15:10
add comment

Several people have mentioned tex4ht but didn't give the command. From my looking around it seems that the command to run is mk4ht oolatex myfile.tex and you should get a .odt file. I tried it on a basic example and it worked great. When I get a chance I will run it on something more complex.

share|improve this answer
1  
thanks. That's helpful. –  Jeromy Anglim Oct 25 '10 at 0:37
    
maybe htlatex myfile.tex? –  tohecz Aug 29 '12 at 10:17
add comment

The best way I know to convert a TeX to an XML application is tex4ht. The project page says it converts TeX to a number of different output formats, including "(X)HTML, MathML, OpenDocument, and DocBook." I believe tex4ht can even convert tikz code to SVG graphics. Word supports OpenDocument, so in theory you could just open up the converted document in Word. I'd expect tables to survive the transition, not so much equations and figures. But MS Word's native format is also an XML application, so you might be able to write an XSLT stylesheet to handle the math and figures.

The need for this kind of tool is evident, and the fact that there's no polished way to do it yet somewhat indicates the complexity of the task. Keep that in mind before you take it up!

share|improve this answer
add comment

I found a very easy solution for converting LaTeX-documents into editable Word-files.

  1. Compile your LaTeX-document to PDF
  2. Go to the Internet-page http://pdftoword.com/
  3. Upload your PDF and wait until the Word-file arrives.

I have only tested the site with text-files (no graphics or formulas), but it converted complex contract in Norwegian (æøå) to pretty exact copies. You loose the structure (no styles, only direct formatting), but it works if you need to send a Word-file for proof reading etc.

Of course, later you have to merge any changes to your LaTeX-source, but still it is better than retyping the document.

For the sake of good order: I have no connections with Nitro Software, I do not even own a copy of their program.

share|improve this answer
5  
Thanks. There seems to be quite a few of these online pdf to doc convertors. I've had mixed success with them especially once graphics, equations, headers and footers and so on get introduced. –  Jeromy Anglim Jan 16 '12 at 22:18
    
Adobe Acrobat now has a pretty good PDF to word converter. Acrobat will cost you a bit, but it's worth a shot if you have access to it. –  Kevin Mar 11 at 13:27
    
Works great, thanks. My file does not include formulas, but formatting, graphics, footnotes and bibliography were converted very well. The trial version allows for 5 conversions per email. –  Denis Golomazov Jun 25 at 5:24
    
The advantage of this tool (and also the problem) is that the Word document looks almost exactly the same as the PDF. I mean, all symbols are in the same places. This is also a problem because the hyphenation signs are translated into dashes. This means that if the Word document will be edited (e.g. by a publisher), they'll get a lot of unwanted dashes in the middle of the lines. –  Denis Golomazov Jun 25 at 5:46
add comment

There's an interesting discussion and comparison of conversion options here: http://web.archive.org/web/20121107120612/http://www.charlietanksley.net/philtex/converting-from-latex/

share|improve this answer
add comment

If you are not forced to stick to a certain format pick your weapon of choice -- tex4ht (you can just use oolatex) , tth, latex2html etc -- and prepare a document style that converts well with that. I do this all the time for simple reports and such that I need to share with people who like using MS-Word etc to edit them. If you spend a bit of time to taylor it for the conversion, you can get consistently good results.

If you have requirements to stick a certain format, for example for a grant proposal etc, you can get by picking up a style that has more or less the right format but with minimal extras to generate the text then use MS-Word or OpenOffice to fix it up.

share|improve this answer
add comment

All answers above suggested to use some converter from tex/pdf file to the wanted file format, that is why I try to give an n-th proposal. I think this approach is quite insane in this situation, as native solutions also exist - as the OP also mentioned.

As you generate the reports from R, it might be the less painful to rewrite some function you use in the reporting process and update those to be able to run in odfWeave. Well, it will generate an odt file from an odt one, so not a native Word format, but it is compatible with Ms Office also from the 2007 version (SP2).

That would require to write the body of your text (if any) and the reporting R code in a word processor (Ms Word or e.g. OOWriter), and later run it via odfWeave. The package has a really great documentation, just download the sources and look for the formatting.odt in the examples directory, which shows in 30+ pages most of the great formatting features of the package. This includes: paragraph, font, color, table, cell, image etc. also.

share|improve this answer
add comment

I don't see Nuance PDF Converter listed in other responses, and I think it is worth a mention. It is not free, but the Mac version that I downloaded has a free trial. I bought it after it successfully converted a PDF that I generated from LaTeX into a clean Word document. Adobe failed miserably on the tables, but Nuance worked well.

share|improve this answer
add comment

The new version of Word (2013) lets you open and edit PDFs. The workflow is then:

  1. Use latex and pdflatex to make your PDF
  2. Open the PDF in Word 2013
  3. Save as docx
share|improve this answer
add comment

I found a good solution through Latex2rtf + TexSword. The process consists performing first the convertion LaTex-> Word (which in my case is around 85% correct), and then to fix the wrong or not converted parts with TexSword (the remaining 15%).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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