vendredi 9 janvier 2026

Generate tex file from docx

Install Inkscape 

https://inkscape.org/

and then in .zshrc, add

export PATH="/Applications/Inkscape.app/Contents/MacOS/:$PATH"

Test if Inkscape can be launched from terminal:

Inkscape -V

Now, after installing pandoc https://pandoc.org/installing.html, you can convert a docx file into tex:

pandoc -s Final.docx -o Final.tex --extract-media=

It will create a media folder with the figures.

Pandoc does not automatically preserve mixed page orientations (landscape/portrait sections) from DOCX to LaTeX, as it lacks direct support for DOCX section properties.

Edit the generated .tex file manually: Add \usepackage{pdflscape} to the preamble, then wrap landscape sections with \begin{landscape}...\end{landscape} around tables or content matching the original DOCX. For global landscape, use \documentclass[landscape]{article}.

The complex tables are not well handed by pandoc. You can generate tables separately:

https://www.tablesgenerator.com/

To test your tex file, you can convert them into pdf using pdflatex installed with mactex:

http://www.tug.org/mactex/

pdflatex --shell-escape Final.tex