Makefile project to build PDFs, HTML, EPUB, and DOCX from Org files with Pandoc, templates, and citation support to a book.
Find a file
2025-09-07 23:15:24 +02:00
content Initial commit 2025-09-07 15:07:50 +02:00
templates Added templates for docx (buggy) 2025-09-07 23:15:24 +02:00
.gitignore Initial commit 2025-09-07 15:07:50 +02:00
Makefile Added templates for docx (buggy) 2025-09-07 23:15:24 +02:00
README.md Initial commit 2025-09-07 15:07:50 +02:00

Org-Book Makefile

This project uses make and Pandoc to build a single book from multiple .org files inside the contentdirectory into different output formats:

  • PDF
  • HTML
  • EPUB
  • DOCX

By default, running make will build all formats into the build/ directory, while make pdf, make html, make epub, or make docx will generate a single format, and make clean will remove all outputs.

Make targets

# Build all document targets (pdf,html,epub,docx)
make

# Build a single target
make pdf

# Show the content files that are included
make show-sources

# Generate the document named "MyBook.pdf"
make NAME=MyBook

Build Options

BIBLIO Specifies one or more .bib bibliography files (space-separated). Pandoc will include these references when processing citations.

CITEPROC Enables Pandocs citation processor to handle bibliographies and citations. Default is 0 (off), set CITEPROC=1 to enable.

CSS_HTML / CSS_PDF / CSS_EPUB
Paths to custom CSS files for styling HTML, PDF (via WeasyPrint), or EPUB.

CSL Points to a Citation Style Language file (e.g., apa.csl). This defines how citations and references are formatted.

LANG Sets the document language. Default is de-DE, use en-US for English.

LINK_CITATIONS When enabled (LINK_CITATIONS=1), citations in the text are hyperlinked to the corresponding reference entry.

NAME Defines the basename for the document creation.

NOCITE_ALL If enabled (NOCITE_ALL=1), Pandoc will include all bibliography entries, even if they are not cited in the text.

REF_TITLE Sets a custom heading for the references section. For example, REF_TITLE=Literature or REF_TITLE=Bibliography.

TEMPLATE_HTML / TEMPLATE_PDF / TEMPLATE_EPUB / TEMPLATE_DOCX Specify custom templates for each output format, located under the templates/ directory.

TOC Enables or disables the table of contents. Set TOC=1 to enable, or TOC=0 (default) to disable.

TOC_DEPTH Controls how many heading levels are included in the table of contents. For example, TOC_DEPTH=2 includes only top-level and second-level headings.

System requirements

You need a working installation of GNU Make, Pandoc, and WeasyPrint. Pandoc handles the conversion from Org-mode to the target formats, while WeasyPrint is required for PDF output (no LaTeX needed). Optionally, you may install CSL styles for citation formatting, and provide custom templates or CSS for styling. On macOS, GNU Make is already available under /usr/bin/make.

Installation on macOS with Homebrew

To install the required tools on macOS using Homebrew, run:

brew install pandoc weasyprint