Theses and Papers

How to Convert LaTeX to Word with Pandoc

Convert LaTeX to Word with Pandoc: install it, run a basic conversion, add citations and a reference style file, and check equations, tables and figures.

On this page
  1. What converts well and what does not
  2. Install Pandoc and check the version
  3. A basic conversion
  4. Add citations with a bibliography and a CSL style
  5. Use a reference Word file for styles
  6. Handle custom macros and class commands
  7. Equations and figures
  8. When Pandoc is not enough
  9. Check the output
  10. A workflow that keeps LaTeX as the source

Pandoc is a widely used free tool that converts LaTeX documents to Word. It turns headings, lists, citations and equations into Word structures, but no conversion is perfect. Expect to clean up tables, figures and cross-references afterwards. This guide shows the basic command, how to add citations and a reference style, how to set up Word styles, and how to check the result.

What converts well and what does not

Results depend on the Pandoc version and on your document, so test on your own file. As a general guide:

Element Usually comes through What to check
Headings, paragraphs, lists Yes Heading levels and numbering
Inline and display math Mostly, as Word equations Large operators, matrices and custom macros
Citations Yes, with a .bib file and a CSL style Numbering and the reference list
Simple tables Usually Column widths and alignment
Complex tables (multi-row cells, sub-tables) Often needs rebuilding The whole table
Figures in PNG or JPG Yes Size and resolution
PDF figures May not appear as expected Convert to PNG first, then check
TikZ diagrams Not reliably Export to PDF or PNG, then insert
Cross-references (\ref) Unreliable Numbers may be lost or plain text
Journal class commands Often ignored, or they cause errors Simplify the preamble

Install Pandoc and check the version

Install Pandoc from its official site or your system’s package manager. Then check that the command runs and note the version:

pandoc --version

The examples below use the current command-line options. An older version may name some of them differently, so check its help text if a flag is not recognized.

A basic conversion

Run the command in the folder that holds main.tex, and any figures and the .bib file, because Pandoc resolves file paths from the current folder:

pandoc main.tex -o main.docx

Pandoc reads the .tex file as LaTeX, because of its extension, and writes a Word file. Open the result and read it from start to finish before you do anything else.

Add citations with a bibliography and a CSL style

For citations, give Pandoc the .bib file and a CSL style. A CSL file describes a citation style such as IEEE or APA. Choose the one your journal or supervisor uses:

pandoc main.tex --citeproc --bibliography=references.bib --csl=ieee.csl -o main.docx

With --citeproc, Pandoc reads the \cite commands, formats them with the CSL style, and builds the reference list from the .bib file. Check the numbering and the order of the list, because a mismatch between the citation key and the .bib entry leaves a citation missing.

Use a reference Word file for styles

By default, the Word output uses Pandoc’s own styles. To match a thesis or journal, create a reference document, edit its styles in Word, and tell Pandoc to use it:

pandoc -o custom-reference.docx --print-default-data-file reference.docx
pandoc main.tex --reference-doc=custom-reference.docx -o main.docx

Open custom-reference.docx in Word and change the styles for Heading 1, Heading 2, Normal and Caption. Save the file, then run the conversion again. Pandoc applies the styles from the reference file to the matching parts of the output.

Handle custom macros and class commands

Pandoc reads the source; it does not run the class file. Commands that only make sense to the class, such as a corresponding-author command or an author-block command, have no Word equivalent. They may be ignored, or they may produce an error or stray text.

  • Remove or simplify class-specific commands in a copy of the document before converting.
  • Keep your own macros simple. Test a macro defined with \newcommand by converting one page that uses it.
  • Keep the original LaTeX as the source, and convert a copy, so the LaTeX document stays clean.

The community wiki entry on converting LaTeX to Word describes a build step that removes parts of a journal class from the file before Pandoc runs. A similar cleanup step may help for your class.

Equations and figures

Math converts to Word’s equation format. Check that each equation renders the way you expect, especially large operators, matrices and any macros you defined. Fix a broken equation in Word’s equation editor rather than trying to get Pandoc to handle it.

For figures, PNG and JPG files usually embed without trouble. PDF figures may not appear as you expect, so convert them to a high-resolution PNG before the conversion. TikZ diagrams are better compiled to PDF or PNG first and then inserted, because Pandoc does not reproduce TikZ drawings reliably.

When Pandoc is not enough

Some parts are faster to fix by hand:

  • A few equations. Current versions of Word accept LaTeX-style input in the equation editor. For one or two formulas, pasting the LaTeX and converting it can be quicker than debugging the conversion. Check your version’s equation menu to see what it supports.
  • Complex tables. Rebuild them in Word, using the values from your LaTeX source.
  • Cross-references and numbers. Check each figure, table and section number against the text and fix any that were lost.

Other routes exist, such as converting through HTML with LaTeXML or through tex4ht. Their results vary with the document, and they need the same checks as Pandoc output.

Check the output

Go through this list in the Word file before you send it:

  • Headings match the sections, and the numbering is right.
  • Every citation appears in the text, and the reference list is complete and in the right order.
  • Equations render and line up.
  • Tables keep their columns and values.
  • Figures appear, with captions and sensible sizes.
  • Cross-references (figure, table and section numbers) point to the right items.
  • Footnotes, dashes and quotation marks look right.
  • The page size and margins match the journal’s Word template, if it has one.

A workflow that keeps LaTeX as the source

The simplest arrangement keeps the LaTeX project as the single source of truth:

  1. Keep working in LaTeX, and use version control to record each state of the document.
  2. Generate the Word copy from a known version, and note which version it matches.
  3. Send the Word file for comments. Changes that come back in Word have to be carried into the LaTeX source by hand.
  4. Regenerate the Word file after the final LaTeX edits, and run the checks again.

The conversion is best left until the text is close to final. Each new conversion repeats the checks, so a copy made early tends to be out of date by the time reviewers reply.

For the general trade-offs between the two tools, see is LaTeX better than MS Word?. For journals that ask for Word, does Elsevier accept LaTeX? covers the submission rules. For a thesis that needs a Word copy for a supervisor, the thesis guide has the setup.

The complete guide to theses and papers

How to Write a Thesis in LaTeX: Templates and Title Pages
Read the guide

Keep exploring

Guides from other topics

All topics →