- Have Homebrew installed and a markdown file you want to render to PDF.
- Install Pandoc
brew install pandoc - Install basictex
brew cask install basictex- needed for the pdflatex tool. - Symlink the pdflatex to your
/usr/local/binso pandoc can easily find it.ln -s /Library/TeX/Root/bin/x86_64-darwin/pdflatex /usr/local/bin/pdflatex - Use Pandoc to generate a PDF from a Markdown file.
pandoc input.md -o output.pdf- By default the margins are pretty large. To optionally change the margins:
pandoc input.md -o output.pdf -V geometry:margin=1in
- By default the margins are pretty large. To optionally change the margins:
Last active
November 16, 2025 16:25
-
-
Save dcchambers/9761c71880114cc604c902b30b2e06c8 to your computer and use it in GitHub Desktop.
Generate a PDF from Markdown files with Pandoc
Note on M1 mac, you will need to use this symlink the universal-darwin directory instead of x86_64-darwin directory
ln -s /Library/TeX/Root/bin/universal-darwin/pdflatex /usr/local/bin/pdflatex
instead of
ln -s /Library/TeX/Root/bin/x86_64-darwin/pdflatex /usr/local/bin/pdflatex
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I ran the above successfully with the following changes
brew cask install basictexwithbrew install basictex --caskbecausebrew caskis no longer abrewcommandeval "$(/usr/libexec/path_helper)"(this is what the installer suggests here)