Skip to content

Latest commit

 

History

History
64 lines (48 loc) · 1.88 KB

File metadata and controls

64 lines (48 loc) · 1.88 KB

README - Compiling the Problem Set PDF

This project combines multiple Markdown (.md) files into a single PDF using Pandoc and WeasyPrint.

Requirements

  1. Install Python 3 https://www.python.org/downloads

  2. Install Pandoc https://pandoc.org/installing.html

  3. Install WeasyPrint Open PowerShell and run: pip install weasyprint

  4. (Windows only) Install GTK Runtime WeasyPrint requires the GTK runtime to render PDFs on Windows. Download and install from: https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer

Folder Structure

pset2025/ ├─ cover.md ├─ problem1.md ├─ problem2.md ├─ ... ├─ problem8.md ├─ style.css └─ custom_logo_photoshop_6_hrs.png

Each .md file should end with:

Building the PDF

Run this command from inside the folder in PowerShell (adjust pdf engine path to your weasyprint install):

pandoc (Get-ChildItem -Filter *.md | Sort-Object Name | ForEach-Object { $_.Name }) `
  -o pset2025.pdf `
  --from markdown+raw_html `
  --pdf-engine="C:\Users\flash\AppData\Roaming\Python\Python313\Scripts\weasyprint.exe" `
  -c style.css

If WeasyPrint is added to your PATH, you can simplify it to:

pandoc (Get-ChildItem -Filter *.md | Sort-Object Name | ForEach-Object { $_.Name }) -o pset2025.pdf --from markdown+raw_html --pdf-engine=weasyprint -c style.css

Notes

  • Margins and font styling are controlled in style.css
  • To adjust margins, edit the "margin" value in style.css
  • Code blocks should use fenced syntax (triple backticks)
  • Make sure all image paths are relative to the folder

Troubleshooting

If you get an error about missing DLLs or Pango, reinstall the GTK runtime. If Pandoc cannot find WeasyPrint, add this folder to your PATH: C:\Users<YourUser>\AppData\Roaming\Python\Python313\Scripts

Output: pset2025.pdf