How to Convert LaTeX to Word DOCX with Pandoc: Equations, Citations, and Styles

Converting LaTeX manuscripts to Word DOCX often breaks citations, drops custom macros, and flattens equations. Here is the exact Pandoc command pipeline to generate native OMML formulas, format references, and handle style updates in Word.

HumanPen Team

· 9 min read

Converting LaTeX to Word DOCX with Pandoc: equations, citations, and styles

Converting a LaTeX manuscript to an editable Word DOCX file requires running Pandoc with explicit flags: `pandoc main.tex --citeproc --bibliography=refs.bib --csl=ieee.csl --reference-doc=custom-reference.docx -o paper.docx`. Bare conversion drops citations, discards unmapped packages as raw TeX, and leaves Word unstyled. Pandoc compiles equations into native editable Office Math objects, but exports citations as static text rather than live reference fields.

Researchers across computer science, physics, economics, and biomedical engineering routinely face journal editorial portals, clinical co-authors, or university advisors who refuse PDF submissions and mandate an editable Microsoft Word (`.docx`) file. Running a naive `pandoc main.tex -o paper.docx` command immediately causes frustration: citation keys turn into unparsed text or disappear entirely, custom preamble macros fail silently, tables lose their borders and padding, and complex floating environments disintegrate. Understanding Pandoc's internal compilation model, configuring reference stylesheets, and anticipating post-conversion editorial workflows ensures your converted document satisfies rigorous publisher standards without manual retyping.

Inside the Pandoc pipeline: why bare conversion drops citations and defaults to Chicago

Pandoc operates through a modular Reader → AST → Writer pipeline rather than a complete LaTeX typesetting engine. When converting a document, Pandoc's LaTeX reader parses `.tex` source markup into an intermediate Abstract Syntax Tree (AST), which represents structural document primitives such as headers, emphasis, math blocks, and citation placeholders. The DOCX writer then translates this generic AST into OpenXML markup. Because Pandoc does not execute arbitrary TeX macro definitions or invoke external BibTeX engines during standard parsing, a bare command like `pandoc paper.tex -o paper.docx` merely encounters citation keys in the AST without any instruction to expand them against a bibliography database.

"-C, --citeproc: Process the citations in the file, replacing them with rendered citations and adding a bibliography. Citation processing will not take place unless bibliographic data is supplied, either through an external file specified using the --bibliography option or the bibliography field in metadata, or via a references section in metadata containing a list of citations in CSL YAML format with Markdown formatting. The style is controlled by a CSL stylesheet specified using the --csl option or the csl field in metadata. (If no stylesheet is specified, the chicago-author-date style will be used by default.)"

Resolving citations requires explicitly activating Pandoc's citation engine using the `-C` or `--citeproc` flag alongside `--bibliography=refs.bib`. Authors migrating from LaTeX frequently make the mistake of passing `--natbib` or `--biblatex`. As the official Pandoc User's Guide specifies, `--natbib` and `--biblatex` are designed exclusively for generating `.tex` output files intended for downstream BibTeX or Biber compilation; they do not perform in-place citation rendering for DOCX. Furthermore, if you enable `--citeproc` but omit the `--csl` flag, Pandoc silently falls back to `chicago-author-date` formatting. For manuscripts targeting numbered IEEE, ACM, or Vancouver formats, failing to supply an official Citation Style Language (`.csl`) file turns numbered bracketed references into author-year citations across your entire manuscript.

Equations, macros, and raw TeX: what translates to Word OMML versus what vanishes

One of Pandoc's greatest strengths when exporting to Microsoft Word is its mathematical translation engine. Instead of converting LaTeX formulas into blurry raster images or outdated MathType objects, Pandoc compiles standard LaTeX math environments into native Microsoft Office Math Markup Language (OMML). When you open the generated `.docx` file in Microsoft Word, inline formulas (`$...$`) and display equations (`[...]` or `\begin{equation}`) appear as native, editable Word equation objects that respect Word's typography and font scaling. Pandoc also handles user-defined macros via its `latex_macros` extension, parsing standard `\newcommand` and `\renewcommand` declarations in your preamble and expanding them throughout mathematical expressions.

"Inline LaTeX is ignored in output formats other than Markdown, LaTeX, Emacs Org mode, and ConTeXt."

However, Pandoc's AST is strictly format-agnostic, meaning any TeX primitive, external package construct, or complex layout environment that cannot map into its generic node tree is categorized as `raw_tex`. When targeting DOCX, Pandoc drops raw TeX completely rather than attempting partial rendering. Authors must therefore prepare their LaTeX source by replacing unsupported structural packages with native equivalents before executing conversion.

LaTeX ElementPandoc Internal HandlingResult in Word DOCXRecommended Preparation / Fix
Standard Math (`amsmath`, `\frac`, `\sum`)Parsed by `texmath` into AST Math nodesNative editable OMML equation objects in WordKeep standard TeX syntax; avoid non-standard macro packages
Preamble Macros (`\newcommand`, `\renewcommand`)Expanded across document by `latex_macros`Evaluated into corresponding AST text or math nodesPlace macro definitions in main file preamble or include block
Vector Graphics (`tikz`, `pgfplots`, `pstricks`)Unmapped TeX graphics commands; classified as `raw_tex`Completely dropped; graphic vanishes from DOCXCompile figures to standalone PDF/SVG/PNG and insert via `\includegraphics`
Floating Environments (`algorithm2e`, `listings`)Proprietary package environments unmapped in ASTFormatting collapses into unstyled or missing textConvert algorithms to formatted Word tables or pre-rendered code blocks
Layout Styling (`\documentclass`, `.cls`, `.sty`)Document-level TeX layout and margins ignoredWord output defaults to standard Normal templateSupply `--reference-doc=custom-reference.docx` with pre-configured styles

Applying journal-compliant fonts, margins, line spacing, and heading styles does not happen inside the `.tex` preamble. Instead, Pandoc provides the `--reference-doc` mechanism. By running `pandoc -o custom-reference.docx --print-default-data-file reference.docx`, you export Pandoc's default Word template. You can then open `custom-reference.docx` in Word, modify the paragraph styles (such as `Normal`, `Heading 1`, `Heading 2`, `Caption`, and `Table`), set margin dimensions, configure running headers and footers, and save the file. When you compile with `--reference-doc=custom-reference.docx`, Pandoc completely ignores any text inside the reference document and applies its styles and page setup directly to your generated manuscript.

The static citations trap: why Pandoc cannot export live Zotero or EndNote fields

The most deceptive limitation encountered by research teams after converting LaTeX to Word is the static nature of Pandoc's citation output. This limitation stems from a fundamental architectural asymmetry in Pandoc's OpenXML implementation: Pandoc supports live reference manager fields on input, but strictly outputs plain formatted text on output.

"When citations is enabled in docx, citations inserted by Zotero or Mendeley or EndNote plugins will be parsed as native pandoc citations. (Otherwise, the formatted citations generated by the bibliographic software will be parsed as regular text.)"

When reading a `.docx` file into its AST, Pandoc's `docx+citations` extension can recognize dynamic XML field codes inserted by Zotero, Mendeley, or EndNote plugin integrations. However, when writing from the AST to `.docx`, Pandoc's `--citeproc` engine replaces citation nodes directly with flat, rendered text strings and appends a static bibliography at the end of the file. There are no underlying Word dynamic field codes (`w:fldSimple` or `w:instrText`) connecting the in-text marks to an active reference database. For collaborative research teams, this creates a major obstacle. As explored in our guide to handling Word field codes and long documents and our analysis of Overleaf LaTeX workflows under institutional review, clicking `Refresh` or `Change Citation Style` in Word's Zotero or EndNote toolbar produces no effect whatsoever on Pandoc-generated citations.

Switching citation styles after co-authors edit the Word manuscript

This static citation behavior becomes critical during multi-author revision cycles. Once you convert a LaTeX manuscript to Word and distribute it to clinical collaborators or co-authors, they spend weeks adding tracked changes, inline comments, structural rewrites, and new references directly inside Microsoft Word. If the target journal subsequently rejects the paper, or if you decide to submit to a journal requiring numbered IEEE references instead of APA author-date citations, you cannot simply re-run Pandoc from your original LaTeX repository without permanently overwriting all of your co-authors' Word edits and tracked changes. Manually renumbering dozens of in-text citations and reorganizing the bibliography in Word is extraordinarily error-prone.

For researchers facing post-Pandoc editorial changes, HumanPen processes `.docx` files to resolve citation format discrepancies without disrupting collaborative revisions. Convert in-text citations and the reference list to a target style, leaving the rest of your text unchanged. The processing pipeline is designed to preserve formatting, tables, figures, citations, and equations while transforming reference styles across major academic standards, including APA, MLA, Chicago, IEEE, and Vancouver.

  • Pre-conversion macro and float audit: Verify that all mathematical shortcuts are defined using standard `\newcommand`, and compile all `tikz` or `algorithm2e` blocks into vector images or clean tabular environments before running Pandoc.
  • Explicit citeproc and CSL compilation: Always execute conversion with explicit bibliography and stylesheet flags, such as `pandoc main.tex --citeproc --bibliography=refs.bib --csl=ieee.csl --reference-doc=custom-reference.docx -o paper.docx`, avoiding `--natbib` or bare commands.
  • Native OMML equation verification: Open the converted `.docx` in Microsoft Word and click several inline and display equations to ensure they activate Word's native Equation Tools rather than appearing as uneditable raw text.
  • Reference document style confirmation: Inspect paragraph line spacing, body text fonts, and heading hierarchy to confirm that your `--reference-doc` template successfully overrode default Word margins and styles.
  • Collaborative citation maintenance: Keep track of any new citations added by co-authors in Word text, ensuring that when switching journal styles, all static citations and bibliography entries update consistently.

Frequently asked questions

Why does running bare `pandoc main.tex -o paper.docx` leave citation keys unparsed or produce question marks? Pandoc uses a modular architecture where the core LaTeX reader only parses text into an abstract syntax tree without executing external bibliography tools. To resolve BibTeX citations, you must explicitly pass the `-C` or `--citeproc` flag along with `--bibliography=yourfile.bib`. If you omit `--citeproc`, Pandoc treats citation commands like `\cite{key}` as unresolved text nodes, leaving raw keys or empty placeholders in your generated Word document.

Can Pandoc export live, editable Zotero or EndNote field codes into a Word DOCX file? No. While Pandoc's `docx+citations` extension can read and parse live Zotero, Mendeley, and EndNote field codes when converting from Word to other formats, its DOCX writer does not generate dynamic OpenXML field codes. The `--citeproc` engine replaces citation nodes with static, pre-rendered text strings and appends a plain text bibliography. Clicking `Refresh` in Zotero or EndNote inside Microsoft Word will not recognize or update these citations.

How does Pandoc handle LaTeX mathematical equations when exporting to Word DOCX? Pandoc compiles LaTeX math expressions into native Microsoft Office Math Markup Language (OMML) objects. When opened in Microsoft Word or PowerPoint, inline formulas and display equations appear as native editable equations rather than raster images, MathType embeds, or static vector shapes. Standard `amsmath` environments like `equation`, `align`, and `gather` translate accurately, though non-standard third-party math packages may require simplification.

How do I apply journal-specific margins, fonts, and heading formatting to a Pandoc Word export? You customize formatting by supplying a style template with the `--reference-doc` flag. Generate a clean base template by running `pandoc -o custom-reference.docx --print-default-data-file reference.docx`, open that file in Microsoft Word, adjust paragraph styles such as Normal, Heading 1, and Caption, configure margins and headers, and save it. Pandoc ignores the sample body text inside the template and applies your custom styles to the output document.

Sources

KEEP READING