Converting LaTeX to pdf, docx, odt in macOS with pandoc

By Keiver, on 06/24/2022, about: latex, pandoc, markdown, pdf, docx

Pandoc a universal document converter is a great app to convert several file types. Here are some sample conversion commands I usually use in my projects It supports several file types like markdown, LaTeX, docx, odt, and many others. It's released under GPL-2.0 license.

macOS installation via brew

brew install pandoc

macOS installation via npm

npm install pandoc

These libs integrate with the pandoc app, but I was able to convert to LaTeX without them

brew install librsvg homebrew/cask/basictex
# python is also required if not installed
brew install python

Sample conversion commands

# Markdown to LaTeX
pandoc -s target.md -o result.tex

# LaTeX to PDF
pdflatex target.tex

# LaTeX to DOCX
pandoc -s target.tex -o result.docx

# LaTeX to ODT
pandoc -s target.tex -o result.docx

References

Pandoc installation
Pandoc official demos

Copyright (C) 2006-2022 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.