- antoniuswiehler
Converting Latex to Word documents
I love using Latex to create beautiful documents. Latex allows me to write like I code: Adding comments and explanations to give context to myself while keeping the output clean. But sometimes I collaborate with someone who does not use latex and asks for a Word document to work on, for example when writing a scientific paper together.
Converting from Latex to Word used to be complicated but here are some simple steps which produce great results.
I work on Ubuntu 20.04 with latex, latexml and pandoc installed:
sudo apt install texlive-latex-extra texlive-bibtex-extra latexml pandoc
1. Create a *.bib file that includes only the currently used citations, to reduce errors
bibexport -o doc_bib_extracted.bib doc.aux
and change the bib file inside doc.tex to the new doc_bib_extracted.bib
2. convert *.tex to *.xml
latexml doc.tex --dest=doc.xml

3. convert *.xml to *.html
latexmlpost --graphicsmap=png --graphicsmap=eps.png --dest doc.html doc.xml
4. convert *.html to *.doc
pandoc -f html -t docx -o doc.docx doc.html
Quite some steps to do, but the result is much nicer than with direct conversions tools. Equations and figures are often well preserved!
Happy writing :)