[Tex/LaTex] How to import an exam or assignment from Word into LaTeX


This is a counterpart to "How can I typeset an exam or assignment paper in LaTeX?", which was from a teacher looking for a template to compose assignments and exams. I'm a student, and I'd like to submit PDFs or printouts composed in LaTeX in response to assignments submitted as Word documents.

As a math and engineering student, I regularly receive emailed or uploaded assignments with .doc (and now .docx) attachments, which generally contain a numbered list of questions (often with parts A, B, C, etc.) to answer. Styles or other advanced Word structuring tools are rarely used. These assignments also frequently contain equations, tables, and images or Microsoft drawing objects (Usually circuits, graphs, or timing diagrams). I don't really mind copying the images over, or, if they're simple, drawing them myself (as I'll likely have to make changes to it in my answer anyways). However, on a long math assignment, the equations get tedious, and a little error in copying is a big problem.

From the tug.org converter page, I see winw2ltx, Word2TeX and Word-To-LaTeX (These utilities have such clever names…) which have some support for equation transformation.

One thing which isn't clear from the documentation is whether the MathType extension to Word must be used to create the equation, or whether it can simply convert an Equation Editor or .docx equation to LaTeX if it's installed on my computer.

The holy grail of answers to this question would be a utility which:

  • Recognizes MS Word numbered lists and outlines (I, 1, a, i, etc.).
  • Is faster than copy-pasting the text of each question into, say, the exam document class, writing the equations, and drawing the diagrams. This is what I do right now. Not too bad, but it adds half an hour to every assignment.
  • Makes better looking documents than the original Word document. I'd like to do a little evangelism here.
  • Includes support for equations, tables, and images.
  • Can import both .doc and .docx files. Saving the .docx as a .doc is not acceptable, as it renders the equations as bitmaps. Saving the .doc as .docx might be acceptable.

I don't really need it to structure the document; if it just sticks some selected text into a section of my LaTeX document, that would be plenty.

Best Answer

I'm sorry I wont be able to provide any answer other than: "Don't do it!"

Other than using some of the converters that you and other people have suggested, which may give you a reasonable place to start, there is really no satisfactory solution to convert an existing Word document into a LaTeX one. This is difficult to implement, and for a good reason. Word and LaTeX have two completely different approaches at describing and encoding documents. Word (as most people use it) stores formatting information while LaTeX encodes the "logical structure" of a document (which then gets translated to TeX formatting instructions while compiling). Trying to get a LaTeX document out of a Word document is somewhat similar to trying to obtain a C++ program from it's binary: You can do it, but the results wont be pretty.

You are better off taking a printout of your assignments and typing the whole thing yourself in LaTeX. Of course you can copy/paste large bodies of text, but for equations there is nothing better than typing them yourself. If you do this for a while, and show your beautiful documents to your teachers and colleagues, you might be even able to convince them to switch to LaTeX all together.

LaTeX is not a format to store pretty documents, it is a fully-fledged system to create those documents.

Related Question