Cross-platform recipes using pandoc. Examples use guide.md as the source file.
sudo dnf install --skip-broken --skip-unavailable --assumeyes \
pandoc texlive-xetex texlive-collection-fontsrecommendedsudo apt install pandoc texlive-xetex texlive-fonts-recommendedbrew install pandoc
brew install --cask basictexOpen a new terminal so PATH picks up LaTeX, then:
sudo tlmgr update --self
sudo tlmgr install collection-fontsrecommendedWorks the same on Linux and macOS.
pandoc guide.md -o guide.pdf \
--pdf-engine=xelatex \
--toc --number-sectionsFlags:
--pdf-engine=xelatex— Unicode-friendly LaTeX engine--toc— generate a table of contents--number-sections— number the headings
Polished tech-doc look: title page, page numbers, header/footer, syntax-highlighted code.
mkdir -p ~/.local/share/pandoc/templates
curl -L https://github.com/Wandmalfarbe/pandoc-latex-template/releases/latest/download/Eisvogel.tar.gz \
| tar xz --strip-components=1 -C ~/.local/share/pandoc/templates eisvogel.latexpandoc guide.md -o guide.pdf \
--pdf-engine=xelatex \
--template eisvogel \
--toc --number-sections \
--listingsIf you don't want a LaTeX install, use an HTML-to-PDF engine instead.
Linux (Fedora):
sudo dnf install --skip-broken --skip-unavailable --assumeyes pandoc weasyprintmacOS:
brew install pandoc weasyprintpandoc guide.md -o guide.pdf --pdf-engine=weasyprintOutput is decent but not LaTeX-grade. Fine for personal reference.
| Problem | Fix |
|---|---|
! LaTeX Error: File 'X.sty' not found (macOS) |
sudo tlmgr install <package> (no .sty suffix) |
! LaTeX Error: File 'X.sty' not found (Linux) |
sudo dnf install texlive-<package> or sudo apt install texlive-<package> |
| Emoji or special characters render as boxes | Add --variable mainfont="DejaVu Sans" to the pandoc command |
| Code blocks overflow the page | Add --listings flag (uses LaTeX listings package for wrapping) |
| Tables look cramped | Add -V geometry:margin=2cm to widen the page area |