How-to: Code listings (minted)¶
Minted produces excellent code listings via Pygments.
1) Enable minted¶
Build with:
Security note: shell escape runs external tools. Only compile trusted sources with it enabled.
2) Inline code¶
3) Block code¶
4) Best practices¶
- Prefer short blocks
- Avoid full-page dumps
- Let minted break long lines (
breaklines=true)
Common problems¶
“You must invoke LaTeX with -shell-escape”¶
Add --shell-escape.
“pygmentize not found”¶
Install Pygments: