Showing posts with label latex. Show all posts
Showing posts with label latex. Show all posts

Wednesday, February 17, 2010

Converting Latex document to HTML / ODT / DOC

I do all my documents in Latex. Actually i usually use emacs org-mode first and later convert it to Latex, but when it comes to using bibtex, it's all latex. It works great and the output dvi/pdf files look so professional. However recently i had to submit the file in .doc format, and i had a real hard time finding good tools to do that.

There are no direct Latex to .doc converters, so the best bet is to go Latex -> HTML -> DOC. There are lots of Latex to HTML converters like latex2html, tth and hevea, but most of them either don't produce good HTML or mess with bibliography references. But after some research i found the best: TeX4ht

TeX4ht is available in ubuntu/debian repo, so to install

sudo apt-get install tex4ht
Conversion is simple:
htlatex document
(please note, there is no .tex suffix)

This will generate document.html, css and bunch of .png files.

Now to convert it to wordprocessor files (odt, doc..),
1. Open the html file with OpenOffice.org
2. File > Save as
3. Choose the format you want to save it in (odt, doc)

If you have images in the document, they will be linked instead of embedded in the document. To fix this: (source)
1. Edit > Links
2. Click "Break Link" for each image link

Posted via web from Tutorial Universe

Tuesday, February 16, 2010

How to Convert a LaTeX file to an Office Format

The following steps are for a GNU/Linux operating system. This will help convert a .tex file to popular office formats like .doc , .odt and HTML format.

Run the following commands:
  1. $ bibtex example.bib
  2. $ latex example.bib
  3. $ tex4ht example.tex
  4. $ mk4ht oolatex example.tex
The odt file will be prepared. This file can be converted into various other formats with OpenOffice.org.

If you are using LyX, there are various conversion options in File -> Export menu. One of them is OpenDocument which will export the file into .odt format.

Note: For the above procedures to work, the package tex4ht should be installed in your system. Some formatting might be lost while converting.