Theresa Arzadon-Labajo

Convert Word into LaTeX

Posted by Theresa Arzadon-Labajo (tarzadon) on Feb 02 2011
Tech Stuff >> Unix-Linux
Start AbiWord, either from Start Menu->Office->AbiWord or typing abiword on the command line
Open up your Word document.
Then go to Save As -> and choose "LaTeX" from the "Save file as type" drop-down menu.

You can also do the export via command line.
abiword --to=tex <file_name>
    where <file_name> is the name of the Word document

This will create a file with the extension .tex
The resulting TeX file is decent, but it will need tweaking.

I wrote some simply shell scripts to convert

doc2tex

#!/bin/bash

echo "Doc -> TeX Conversion Tool.  Theresa Arzadon-Labajo '11. GPL"

if [ $# != 1 ]; then
        echo -e "Usage:\\n\\t `basename $0` <file>"
        exit 1;
fi

if [ ${1/*./} != "doc" ]; then
        echo -e "Usage:\\n\\t `basename $0` <file>"
        exit 1;
fi

FILE_NAME=$1
TEX_FILE_NAME=`basename $1 .doc`.tex

abiword --to=tex $FILE_NAME
if [ $? != "0" ]; then
        echo -e "Error creating TeX file"
        exit 1;
fi

doc2tex2pdf

#!/bin/bash

echo "Doc -> laTeX -> PDF Conversion Tool.  Theresa Arzadon-Labajo '11. GPL"

if [ $# != 1 ]; then
        echo -e "Usage:\\n\\t `basename $0` <file>"
        exit 1;
fi


if [ ${1/*./} != "doc" ]; then
        echo -e "Usage:\\n\\t `basename $0` <file>"
        exit 1;
fi

FILE_NAME=$1
DVI_FILE_NAME=`basename $1 .doc`.dvi
TEX_FILE_NAME=`basename $1 .doc`.tex
PS_FILE_NAME=`basename $1 .doc`.ps
PDF_FILE_NAME=`basename $1 .doc`.pdf

abiword --to=tex $FILE_NAME
if [ $? != "0" ]; then
        echo -e "Error creating TeX file"
        exit 1;
fi

latex $TEX_FILE_NAME
if [ $? != "0" ]; then
        echo -e "Error LaTeXing file"
        exit 1;
fi

dvips -o $PS_FILE_NAME $DVI_FILE_NAME
if [ $? != "0" ]; then
        echo -e "Error creating PS file"
        exit 1;
fi

ps2pdf $PS_FILE_NAME
if [ $? != "0" ]; then
        echo -e "Error creating PDF file"
        exit 1;
fi

acroread $PDF_FILE_NAME


latex2pdf

#!/bin/bash

echo "laTeX -> PDF Conversion Tool.  Theresa Arzadon-Labajo '11. GPL"

if [ $# != 1 ]; then
        echo -e "Usage:\\n\\t `basename $0` <file>"
        exit 1;
fi


if [ ${1/*./} != "tex" ]; then
        echo -e "Usage:\\n\\t `basename $0` <file>"
        exit 1;
fi

FILE_NAME=$1
DVI_FILE_NAME=`basename $1 .doc`.dvi
PS_FILE_NAME=`basename $1 .doc`.ps
PDF_FILE_NAME=`basename $1 .doc`.pdf

latex $1
dvips -o $PS_FILE_NAME $DVI_FILE_NAME
ps2pdf $PS_FILE_NAME
acroread $PDF_FILE_NAME

Last changed: Feb 27 2020 at 4:11 PM

Back