Extreme TeX and **LaTeX* newcomer, I am trying to convert a .tex to a .docx (Word) document.

I am using the pandoc command line utility and got so far as converting the document, i.e., by doing something like pandoc tex-file.tex -s -o word-file.docx. That worked, but didn't seem to recognize the document class, which is a file in the same directory with a name like class.cls.

When I (clumsily) tried something like pandoc tex-file.tex -s -o --variable documentclass='class-cls' word-file.docx, an error was returned: openFile: does not exist (No such file or directory).

Can you point me in the right direction for converting a .tex to a .docx file with a certain document class using pandoc (or, if recommended, another tool)?

  • 2
    Welcome! I've used tex4ht, even with a custom class. However, you may need to adapt the document for it to work properly and will certainly need to clean up the result. Using this method, I convert first to ODT and then export DOCX from LibreOffice. – cfr Feb 26 '18 at 3:56
  • 1
    as @cfr said, you should have better luck with tex4ht, because it supports custom LaTeX commands and packages. You will probably need some configuration, I can look at it if you provide a mwe and your class. – michal.h21 Feb 26 '18 at 7:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.