Convert Word tables to EPS for inclusion in LaTeX

You might want to skip this post if any of the following is true:

  • You don’t know what LaTeX is.
  • You don’t care about typesetting theses.
  • You’re just generally low on Nerd midi-chlorians.

Recently, we (Mr Cricket and I) helped a good friend (argh, he might already have an acronym assigned,  I should make a glossary for this blog…) typeset his PhD thesis in LaTeX. Sounds straight-forward, were it not for the fact that most of the material was in MS Word to start off with. :)

It mostly comes down to a simple but laborious process of of taking one LaTeX PhD thesis framework (mine) and copy-pasting loads of text from Word into LaTeX, taking care to sprinkle with sufficient amounts of markup.  There are two slightly more complicated issues: The first is correctly converting figures, taking care to save bitmaps as PNGs (these will be converted to EPS via JPG later) and vector graphics as EPS.  I’ve written before about how to convert Visio to EPS for inclusion to LaTeX.

This quick post is concerned with the second problem: What is the best way to go about converting tables from Word to LaTeX?  Seeing that this was in actual fact the second PhD thesis I had converted from Word to LaTeX, including numerous tables, I have by now burnt my fingers on 68 different occasions, each time in an excruciating new and interesting way!  I’d like to spare you that pain, so here is, without (too much) further ado, the Best Way to Convert Word Tables to EPS for Inclusion into LaTeX!

No, we we are definitely NOT going to recode all Word tables in LaTeX markup, because that would be anti-social.  Instead, we are going to print all tables to EPS, then autocrop them and then simply include them into LaTeX via the includegraphics call inside of a normal table float.  Ok?

Here we go:

  1. Install PDFCreator.
  2. Select the table you want to convert in Word, then select “Print Selection” and select PDFCreator as the destination printer.
  3. Select the “Properties” button on the print dialog, then “Advanced”, “PostScript Options”, set “PostScript Output Option” to “Encapsulated PostScript (EPS)”
  4. Now print to file.
  5. Copy the output file to a linux machine (or use a live CD with ps2eps) and do the following:
    ps2eps -B -C -l < printed_output.prn > result_cropped.eps
    
  6. You can now include result_cropped.eps in your LaTeX document with the following code:
    \begin{table}
    \begin{center}
    \caption{Your table's caption}
    \includegraphics{result_cropped.eps}
    \label{tab:your_label}
    \end{center}
    \end{table}
    

If you took care to match the font you used in Word with your LaTeX font, people will probably not even realise that your tables are not LaTeX-native. That’s a clear-cut case of maximum Nerd street-cred with the minimum of actual fuss…

7 thoughts on “Convert Word tables to EPS for inclusion in LaTeX”

  1. The problem is not in the conversion. The problem is in the fact that somebody actually used WORD in to make the tables. Or to take it one step further; that he actually used it in the first place.

  2. Why not simply copy paste the table into excel and use the excel add-in excel2LaTeX (or any other similar tool)? Worked nicely for me. Editable. And no worries about having the right font.

    1. The tables were already very nicely typeset and formatted. My approach maintains all of this with the least possible effort. Your suggestion would certainly work fine under other circumstances, thanks for contributing.

  3. If you are on Windows and have Adobe Acrobat Pro (our institution has a site licence), you can simply save the page you want to PDF using the save as…. dialog box in Word.

    Then open up the PDF in Acrobat Pro and use Document -> crop, select your table, press Enter and then save the PDF. And just include the using includegraphics.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.