export · 14m

Export, images, math, and citations

One Org file is semantic content; export chooses how that content becomes HTML, a PDF, or a bibliography.

C-c C-e opens the export dispatcher. Built-in backends cover HTML, LaTeX/PDF, OpenDocument, ASCII/UTF-8 text, and Org itself. Markdown exporters ship with Org but may need (require 'ox-md). PDF normally means Org to LaTeX to a TeX engine, so a working TeX distribution is an external dependency you must install and maintain yourself.

Document metadata is plain text at the top of the file:

#+TITLE: Service Reliability Report
#+AUTHOR: Maya Chen
#+DATE: 2026-09-01
#+OPTIONS: toc:2 num:t
#+LANGUAGE: en

HTML can pull in a stylesheet with #+HTML_HEAD:. LaTeX accepts document-class and header keywords. But avoid filling the source with backend-specific markup until a real requirement exists. Pandoc helps when a target or house style is better served by its conversion ecosystem; the native exporters understand Org semantics most directly.

Images, math, and citations

Images are links, with optional caption and name:

#+CAPTION: Weekly processing time.
#+NAME: fig:processing
[[file:figures/processing-time.png]]

C-c C-x C-v toggles inline image display. Keep media in predictable relative directories so preview, export, Git, and publishing all agree.

Math uses LaTeX fragments, inline or displayed:

The relationship is \( E = mc^2 \).
\[
\bar{x} = \frac{1}{n}\sum_{i=1}^{n}x_i
\]

Preview with C-c C-x C-l (org-latex-preview); rendering needs a TeX toolchain. A good preview does not prove the final PDF build. High-quality previews and final output can use different pipelines.

Modern Org citations are native. Declare a bibliography, cite, and print:

#+bibliography: references.bib
The method follows earlier literate-programming work [cite:@schulte2012].
#+print_bibliography:

Insert with M-x org-cite-insert. The default basic processor reads BibTeX or CSL. Export processors include basic, csl, bibtex, natbib, and biblatex; CSL uses citeproc-el, the last three target LaTeX. Select one explicitly when typography matters: #+cite_export: csl styles/apa.csl. Older org-ref tutorials still describe specialist workflows, but org-cite is the current baseline. Do not mix syntaxes casually.

Long-form and backend-neutral source

For a book, use one master file with includes:

#+TITLE: Reliable Small Systems
#+INCLUDE: "chapters/01-foundations.org"
#+INCLUDE: "chapters/02-operations.org"
#+bibliography: references.bib
#+print_bibliography:

Export succeeds reliably when content, structure, and presentation stay separate: Org holds semantic content, export settings select representation, CSS or LaTeX controls typography, and the build environment supplies external programs. A raw LaTeX block degrades in HTML and a raw HTML block does nothing for PDF, so when two outputs matter, test both early. Cross-references should target named elements or stable IDs, and relative asset paths let a project move. Export in CI before release so missing figures and TeX errors fail visibly.

Summary. The export dispatcher turns a single source into HTML, LaTeX/PDF, ODT, and text. Images are links, math is LaTeX fragments, and citations use native org-cite. Backend-specific markup is an escape hatch, not a starting point.

Exercises

  • Basic: Export a two-section document to HTML with `C-c C-e`, then trace the HTML and PDF pipelines and name each external dependency.
  • Practical: Add a captioned image, one `org-cite` citation, and a bibliography; build one chapter to both HTML and PDF and fix every backend warning you understand.
  • Advanced: Export the same source to HTML and PDF, document the backend-specific differences, and choose between `pdflatex`, `xelatex`, and `lualatex` for your fonts.