Writing: Pandoc Citation Workflow

Configure Pandoc for automatic citation formatting in any academic style

Why Pandoc?

Pandoc is the industry-standard document converter for academic writing:

  • ✅ Free, open-source document converter
  • ✅ Converts Markdown → Word/PDF/LaTeX/HTML
  • Automatic citation formatting with CSL
  • ✅ 10,000+ citation styles (APA, Chicago, MLA, IEEE, etc.)
  • ✅ Industry standard for academic writing

Citation Style Flexibility: Pandoc supports over 10,000 citation styles through the Citation Style Language (CSL) format. Switch from APA to Chicago to MLA with a single command-line parameter.

Installation and Setup

Install Pandoc

Choose the installation method for your operating system:

Install using Homebrew:

brew install pandoc

Verify installation:

pandoc --version

Expected output: pandoc 3.x.x or higher

Install via apt (Ubuntu/Debian):

sudo apt update
sudo apt install pandoc

Verify installation:

pandoc --version

Expected output: pandoc 3.x.x or higher

Install using Chocolatey:

choco install pandoc

Or download installer from pandoc.org/installing

Verify installation:

pandoc --version

Expected output: pandoc 3.x.x or higher

Download Citation Styles

Create a directory for CSL citation styles and download commonly used formats:

mkdir -p ~/.pandoc/csl

Download APA 7th edition style:

curl -sL "https://www.zotero.org/styles/apa" -o ~/.pandoc/csl/apa.csl

Download Chicago Author-Date style:

curl -sL "https://www.zotero.org/styles/chicago-author-date" -o ~/.pandoc/csl/chicago.csl

Browse all 10,000+ citation styles at zotero.org/styles

Verify Citation Style Files

Check that CSL files are in the correct location:

ls -la ~/.pandoc/csl/

Expected output:

apa.csl
chicago-author-date.csl

Writing with Citations

Citation Syntax in Markdown

Pandoc uses BibTeX citation keys with @ prefix. Write your academic content in Markdown:

# Introduction

Recent studies show AI improves research efficiency [@smith_2024; @jones_2023].
However, concerns about accuracy remain [@martinez_2024, p. 42].

@wilson_2024 argues that hybrid human-AI workflows maximize productivity.

# Literature Review

The platform economy literature [@parker_2016; @cusumano_2020] establishes
foundational concepts for digital ecosystems.

Citation Patterns:

  • In-text citation: [@author_year]
  • Multiple citations: [@author1_year; @author2_year]
  • Citation with page: [@author_year, p. 42]
  • Narrative citation: @author_year argues...

Compiling to Word with Citations

Convert Markdown to formatted Word document with automatic citations:

pandoc paper.md \
  --bibliography ~/Documents/library.bib \
  --citeproc \
  --csl ~/.pandoc/csl/apa.csl \
  -o paper.docx

Parameter explanation:

  • paper.md - Input Markdown file
  • --bibliography - Path to BibTeX reference library
  • --citeproc - Enable citation processing
  • --csl - Citation style to use
  • -o paper.docx - Output Word document

Compiling to PDF with LaTeX

For publication-ready PDFs:

pandoc paper.md \
  --bibliography ~/Documents/library.bib \
  --citeproc \
  --csl ~/.pandoc/csl/apa.csl \
  --pdf-engine=xelatex \
  -o paper.pdf

LaTeX Requirement: PDF generation requires LaTeX installed on your system. Install MacTeX (macOS), TeX Live (Linux), or MiKTeX (Windows).

Switching Citation Styles

Change citation format by simply pointing to a different CSL file:

# APA format
pandoc paper.md --bibliography library.bib --citeproc \
  --csl ~/.pandoc/csl/apa.csl -o paper-apa.docx

# Chicago format
pandoc paper.md --bibliography library.bib --citeproc \
  --csl ~/.pandoc/csl/chicago.csl -o paper-chicago.docx

# MLA format (download first)
curl -sL "https://www.zotero.org/styles/modern-language-association" \
  -o ~/.pandoc/csl/mla.csl

pandoc paper.md --bibliography library.bib --citeproc \
  --csl ~/.pandoc/csl/mla.csl -o paper-mla.docx

Automation Script

📂 Code example: 02-code-examples/pandoc-workflows/compile-paper-with-citations.sh

Create a reusable compilation script:

#!/bin/bash
# compile-paper-with-citations.sh

INPUT_FILE="$1"
OUTPUT_FORMAT="${2:-docx}"  # Default to Word
STYLE="${3:-apa}"           # Default to APA

if [ -z "$INPUT_FILE" ]; then
  echo "Usage: ./compile-paper.sh <input.md> [docx|pdf] [apa|chicago|mla]"
  exit 1
fi

BIBLIOGRAPHY="$HOME/Documents/library.bib"
CSL_FILE="$HOME/.pandoc/csl/${STYLE}.csl"
OUTPUT_FILE="${INPUT_FILE%.md}.${OUTPUT_FORMAT}"

pandoc "$INPUT_FILE" \
  --bibliography "$BIBLIOGRAPHY" \
  --citeproc \
  --csl "$CSL_FILE" \
  -o "$OUTPUT_FILE"

echo "✅ Compiled: $OUTPUT_FILE (Style: $STYLE)"

Usage:

chmod +x compile-paper.sh

# Compile to Word with APA
./compile-paper.sh dissertation.md

# Compile to PDF with Chicago
./compile-paper.sh dissertation.md pdf chicago

# Compile to Word with MLA
./compile-paper.sh dissertation.md docx mla

Next Steps