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:
Install PDFCreator.
Select the table you want to convert in Word, then select “Print Selection” and select PDFCreator as the destination printer.
Select the “Properties” button on the print dialog, then “Advanced”, “PostScript Options”, set “PostScript Output Option” to “Encapsulated PostScript (EPS)”
Now print to file.
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
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…