LaTeX is a great tool for academic writing. However, not all collaborators may be familiar with it, and at times, you may need to convert your document into a Word file for reviewing and editing purposes. In my opinion, the best tool for this task is Pandoc - an open-source command-line tool for free.
Following the tutorial below, I installed pandoc
and successfully converted paper.tex
to paper.docx
:
How to Convert from Latex to MS Word with ‘Pandoc’ - Zhelin Chen
In this blog, I will share a simple command snippet that converts LaTeX to Word file. Additionally, I will also discuss some aspects that were not fully covered in the aforementioned tutorial.
After runing this command, a Word file will be generated in the ./word/
folder:
pandoc paper.tex -o word/paper.docx --reference-doc=word/template.docx --bibliography=bibliography.bib --citeproc
Noted that ./word/template.docx
is a Word file serving as the referencing template and ./bibliography.bib
is the LaTeX bibliography file.
You may have noticed the --reference-doc
variable here. It accepts a Word file as the template so that you can specify the styles of the generated file. You can prepared a Word file as template following these steps:
--reference-doc
:
pandoc paper.tex -o word/template.docx --bibliography=bibliography.bib --citeproc
./word/template.docx
file 1. Changing the styles of a Word document is itself a sophisticated topic. You can read the following tutorial for more detail:
pandoc paper.tex -o word/paper.docx --reference-doc=word/template.docx --bibliography=bibliography.bib --citeproc
P.S. If you'd like to reset the default template 2, placing the reference.docx
to $HOME/.local/share/pandoc
then the template shall overwrite the default settings.
Pandoc usually fails to follow the images resizing instructions in LaTeX, resulting in large images occupying entire pages. For editing purposes, it may be more reader friendly to remove all images 3. Although Pandoc does not provide a "remove all images" option, a simple workaround can solve this problem:
Rename the figure folder so that the images cannot be found and Pandoc will leave it blank.
According to Unable to create a custom reference.docx using pandoc - Stackoverflow, the personal-specified template file reference.docx
should be revised based on a pandoc default output file. ↩
Please refer to --data-dir=DIRECTORY
entry of Manual - Pandoc ↩
In my case, the generated Word file is only used for editing and proofreading by my supervisor and teammates. ↩