Initial commit
This commit is contained in:
412
skills/pandoc/references/conversion_guide.md
Normal file
412
skills/pandoc/references/conversion_guide.md
Normal file
@@ -0,0 +1,412 @@
|
||||
# Pandoc Conversion Guide
|
||||
|
||||
Format-specific conversion instructions and best practices.
|
||||
|
||||
## PDF Conversion
|
||||
|
||||
### Basic PDF
|
||||
|
||||
```bash
|
||||
pandoc document.md -o document.pdf
|
||||
```
|
||||
|
||||
### With Smart Defaults
|
||||
|
||||
```bash
|
||||
pandoc document.md -o document.pdf \
|
||||
--pdf-engine=pdflatex \
|
||||
--number-sections
|
||||
```
|
||||
|
||||
### PDF Engines
|
||||
|
||||
**pdflatex (default)**
|
||||
- Fast, widely available
|
||||
- ASCII-only (no Unicode support)
|
||||
- Good for most documents
|
||||
```bash
|
||||
pandoc doc.md -o doc.pdf --pdf-engine=pdflatex
|
||||
```
|
||||
|
||||
**XeLaTeX**
|
||||
- Unicode support
|
||||
- Custom fonts
|
||||
- Slightly slower
|
||||
```bash
|
||||
pandoc doc.md -o doc.pdf --pdf-engine=xelatex
|
||||
```
|
||||
|
||||
**LuaLaTeX**
|
||||
- Modern, full Unicode
|
||||
- Advanced typography
|
||||
- Slowest option
|
||||
```bash
|
||||
pandoc doc.md -o doc.pdf --pdf-engine=lualatex
|
||||
```
|
||||
|
||||
### With Citations
|
||||
|
||||
```bash
|
||||
pandoc paper.md -o paper.pdf \
|
||||
--pdf-engine=pdflatex \
|
||||
--citeproc \
|
||||
--number-sections
|
||||
```
|
||||
|
||||
### Custom Margins
|
||||
|
||||
```bash
|
||||
pandoc doc.md -o doc.pdf \
|
||||
-V geometry:margin=1.5in
|
||||
```
|
||||
|
||||
### Table of Contents
|
||||
|
||||
```bash
|
||||
pandoc doc.md -o doc.pdf \
|
||||
--toc \
|
||||
--toc-depth=3
|
||||
```
|
||||
|
||||
### Custom Template
|
||||
|
||||
```bash
|
||||
pandoc doc.md -o doc.pdf \
|
||||
--template=custom.tex
|
||||
```
|
||||
|
||||
## HTML Conversion
|
||||
|
||||
### Standalone HTML
|
||||
|
||||
```bash
|
||||
pandoc doc.md -o doc.html --standalone
|
||||
```
|
||||
|
||||
### Self-Contained (Embed Resources)
|
||||
|
||||
```bash
|
||||
pandoc doc.md -o doc.html \
|
||||
--standalone \
|
||||
--self-contained
|
||||
```
|
||||
|
||||
### With Table of Contents
|
||||
|
||||
```bash
|
||||
pandoc doc.md -o doc.html \
|
||||
--standalone \
|
||||
--toc \
|
||||
--toc-depth=3
|
||||
```
|
||||
|
||||
### Custom CSS
|
||||
|
||||
```bash
|
||||
pandoc doc.md -o doc.html \
|
||||
--standalone \
|
||||
--css=style.css
|
||||
```
|
||||
|
||||
### Syntax Highlighting
|
||||
|
||||
```bash
|
||||
pandoc doc.md -o doc.html \
|
||||
--standalone \
|
||||
--highlight-style=tango
|
||||
```
|
||||
|
||||
Available highlight styles:
|
||||
- `tango` (default)
|
||||
- `pygments`
|
||||
- `kate`
|
||||
- `monochrome`
|
||||
- `espresso`
|
||||
- `zenburn`
|
||||
- `haddock`
|
||||
- `breezedark`
|
||||
|
||||
### Fragment (No HTML/Body Tags)
|
||||
|
||||
```bash
|
||||
pandoc doc.md -o fragment.html
|
||||
# No --standalone flag
|
||||
```
|
||||
|
||||
## DOCX Conversion
|
||||
|
||||
### Basic DOCX
|
||||
|
||||
```bash
|
||||
pandoc doc.md -o doc.docx
|
||||
```
|
||||
|
||||
### With Reference Template
|
||||
|
||||
```bash
|
||||
pandoc doc.md -o doc.docx \
|
||||
--reference-doc=template.docx
|
||||
```
|
||||
|
||||
### With Citations
|
||||
|
||||
```bash
|
||||
pandoc paper.md -o paper.docx \
|
||||
--citeproc
|
||||
```
|
||||
|
||||
### Preserve Formatting
|
||||
|
||||
```bash
|
||||
pandoc doc.md -o doc.docx \
|
||||
--standalone
|
||||
```
|
||||
|
||||
## Presentation Conversion
|
||||
|
||||
### Beamer (PDF Slides)
|
||||
|
||||
**Basic:**
|
||||
```bash
|
||||
pandoc slides.md -o slides.pdf --to beamer
|
||||
```
|
||||
|
||||
**With Theme:**
|
||||
```yaml
|
||||
---
|
||||
title: "Presentation"
|
||||
author: "Name"
|
||||
theme: Madrid
|
||||
colortheme: default
|
||||
---
|
||||
```
|
||||
|
||||
```bash
|
||||
pandoc slides.md -o slides.pdf --to beamer
|
||||
```
|
||||
|
||||
**Slide Breaks:**
|
||||
```markdown
|
||||
# Section Title
|
||||
|
||||
## Slide 1
|
||||
|
||||
Content
|
||||
|
||||
## Slide 2
|
||||
|
||||
More content
|
||||
```
|
||||
|
||||
### reveal.js (Web Slides)
|
||||
|
||||
**Basic:**
|
||||
```bash
|
||||
pandoc slides.md -o slides.html \
|
||||
--to revealjs \
|
||||
--standalone
|
||||
```
|
||||
|
||||
**With Theme:**
|
||||
```bash
|
||||
pandoc slides.md -o slides.html \
|
||||
--to revealjs \
|
||||
--standalone \
|
||||
-V theme=black \
|
||||
-V transition=slide
|
||||
```
|
||||
|
||||
**Available Themes:**
|
||||
- black (default)
|
||||
- white
|
||||
- league
|
||||
- beige
|
||||
- sky
|
||||
- night
|
||||
- serif
|
||||
- simple
|
||||
- solarized
|
||||
|
||||
**Custom Background:**
|
||||
```markdown
|
||||
## Slide Title {background-color="#2E3440"}
|
||||
|
||||
Content
|
||||
```
|
||||
|
||||
**Two Columns:**
|
||||
```markdown
|
||||
::::: {.columns}
|
||||
|
||||
:::: {.column width="50%"}
|
||||
Left content
|
||||
::::
|
||||
|
||||
:::: {.column width="50%"}
|
||||
Right content
|
||||
::::
|
||||
|
||||
:::::
|
||||
```
|
||||
|
||||
## Advanced Options
|
||||
|
||||
### Metadata Override
|
||||
|
||||
```bash
|
||||
pandoc doc.md -o doc.pdf \
|
||||
-M title="New Title" \
|
||||
-M author="Author Name"
|
||||
```
|
||||
|
||||
### Include Files
|
||||
|
||||
```bash
|
||||
pandoc doc.md -o doc.pdf \
|
||||
--include-before-body=header.tex \
|
||||
--include-after-body=footer.tex
|
||||
```
|
||||
|
||||
### Filters
|
||||
|
||||
```bash
|
||||
pandoc doc.md -o doc.pdf \
|
||||
--filter pandoc-citeproc \
|
||||
--lua-filter=custom.lua
|
||||
```
|
||||
|
||||
### Resource Path
|
||||
|
||||
```bash
|
||||
pandoc doc.md -o doc.pdf \
|
||||
--resource-path=.:images:assets
|
||||
```
|
||||
|
||||
### Variables
|
||||
|
||||
```bash
|
||||
pandoc doc.md -o doc.pdf \
|
||||
-V documentclass=report \
|
||||
-V fontsize=12pt \
|
||||
-V geometry:margin=1in
|
||||
```
|
||||
|
||||
## Defaults Files
|
||||
|
||||
Instead of long command lines, use defaults files:
|
||||
|
||||
**Create defaults file:**
|
||||
```yaml
|
||||
# defaults.yaml
|
||||
from: markdown
|
||||
to: pdf
|
||||
pdf-engine: pdflatex
|
||||
citeproc: true
|
||||
number-sections: true
|
||||
metadata:
|
||||
fontsize: 12pt
|
||||
geometry: margin=1in
|
||||
```
|
||||
|
||||
**Use defaults:**
|
||||
```bash
|
||||
pandoc doc.md --defaults=defaults.yaml -o doc.pdf
|
||||
```
|
||||
|
||||
## Batch Conversion
|
||||
|
||||
### Convert All MD Files
|
||||
|
||||
```bash
|
||||
for file in *.md; do
|
||||
pandoc "$file" -o "${file%.md}.pdf" --pdf-engine=pdflatex
|
||||
done
|
||||
```
|
||||
|
||||
### With Validation
|
||||
|
||||
```bash
|
||||
PLUGIN_DIR="~/.claude/marketplaces/cadrianmae-claude-marketplace/plugins/pandoc"
|
||||
|
||||
for file in *.md; do
|
||||
if python3 "$PLUGIN_DIR/skills/pandoc/scripts/validate.py" "$file"; then
|
||||
pandoc "$file" -o "${file%.md}.pdf"
|
||||
fi
|
||||
done
|
||||
```
|
||||
|
||||
## Format Detection
|
||||
|
||||
Pandoc auto-detects formats from extensions:
|
||||
|
||||
| Extension | Format |
|
||||
|-----------|--------|
|
||||
| `.md`, `.markdown` | Markdown |
|
||||
| `.pdf` | PDF |
|
||||
| `.html`, `.htm` | HTML |
|
||||
| `.docx` | DOCX |
|
||||
| `.tex` | LaTeX |
|
||||
| `.epub` | EPUB |
|
||||
| `.rst` | reStructuredText |
|
||||
| `.org` | Org-mode |
|
||||
|
||||
Override with `--from` and `--to`:
|
||||
```bash
|
||||
pandoc input.txt --from markdown --to html -o output.html
|
||||
```
|
||||
|
||||
## Common Patterns
|
||||
|
||||
### Academic Paper
|
||||
|
||||
```bash
|
||||
pandoc paper.md -o paper.pdf \
|
||||
--pdf-engine=pdflatex \
|
||||
--citeproc \
|
||||
--number-sections \
|
||||
--toc \
|
||||
--toc-depth=3
|
||||
```
|
||||
|
||||
### Web Article
|
||||
|
||||
```bash
|
||||
pandoc article.md -o article.html \
|
||||
--standalone \
|
||||
--self-contained \
|
||||
--toc \
|
||||
--css=style.css \
|
||||
--highlight-style=tango
|
||||
```
|
||||
|
||||
### Presentation
|
||||
|
||||
```bash
|
||||
pandoc slides.md -o slides.html \
|
||||
--to revealjs \
|
||||
--standalone \
|
||||
-V theme=black \
|
||||
-V transition=slide
|
||||
```
|
||||
|
||||
### Book/Thesis
|
||||
|
||||
```bash
|
||||
pandoc thesis.md -o thesis.pdf \
|
||||
--pdf-engine=xelatex \
|
||||
--citeproc \
|
||||
--number-sections \
|
||||
--toc \
|
||||
--toc-depth=4 \
|
||||
-V documentclass=book \
|
||||
-V fontsize=12pt \
|
||||
-V geometry:margin=1in
|
||||
```
|
||||
|
||||
## Performance Tips
|
||||
|
||||
1. **Use pdflatex for speed** - Switch to xelatex only if needed
|
||||
2. **Cache intermediate files** - Use `--standalone` wisely
|
||||
3. **Batch similar conversions** - Reuse pandoc process
|
||||
4. **Optimize images** - Compress before embedding
|
||||
5. **Use defaults files** - Faster than parsing long command lines
|
||||
298
skills/pandoc/references/snippets.md
Normal file
298
skills/pandoc/references/snippets.md
Normal file
@@ -0,0 +1,298 @@
|
||||
# Pandoc Quick Reference Snippets
|
||||
|
||||
Copy-paste ready commands for common Pandoc operations.
|
||||
|
||||
## Validation
|
||||
|
||||
```bash
|
||||
# Validate document
|
||||
PLUGIN_DIR="~/.claude/marketplaces/cadrianmae-claude-marketplace/plugins/pandoc"
|
||||
python3 "$PLUGIN_DIR/skills/pandoc/scripts/validate.py" document.md
|
||||
```
|
||||
|
||||
## Basic Conversions
|
||||
|
||||
```bash
|
||||
# Markdown to PDF
|
||||
pandoc document.md -o document.pdf
|
||||
|
||||
# Markdown to HTML
|
||||
pandoc document.md -o document.html --standalone
|
||||
|
||||
# Markdown to DOCX
|
||||
pandoc document.md -o document.docx
|
||||
```
|
||||
|
||||
## PDF with Options
|
||||
|
||||
```bash
|
||||
# Academic paper
|
||||
pandoc paper.md -o paper.pdf \
|
||||
--pdf-engine=pdflatex \
|
||||
--citeproc \
|
||||
--number-sections \
|
||||
--toc
|
||||
|
||||
# With XeLaTeX (Unicode support)
|
||||
pandoc paper.md -o paper.pdf \
|
||||
--pdf-engine=xelatex \
|
||||
--citeproc \
|
||||
--number-sections
|
||||
|
||||
# Custom margins
|
||||
pandoc doc.md -o doc.pdf \
|
||||
-V geometry:margin=1.5in
|
||||
```
|
||||
|
||||
## HTML with Options
|
||||
|
||||
```bash
|
||||
# Standalone HTML with TOC
|
||||
pandoc doc.md -o doc.html \
|
||||
--standalone \
|
||||
--toc \
|
||||
--toc-depth=3
|
||||
|
||||
# Self-contained (embed resources)
|
||||
pandoc doc.md -o doc.html \
|
||||
--standalone \
|
||||
--self-contained
|
||||
|
||||
# With custom CSS
|
||||
pandoc doc.md -o doc.html \
|
||||
--standalone \
|
||||
--css=style.css
|
||||
|
||||
# With syntax highlighting
|
||||
pandoc doc.md -o doc.html \
|
||||
--standalone \
|
||||
--highlight-style=tango
|
||||
```
|
||||
|
||||
## Presentations
|
||||
|
||||
```bash
|
||||
# Beamer PDF slides
|
||||
pandoc slides.md -o slides.pdf --to beamer
|
||||
|
||||
# reveal.js web slides
|
||||
pandoc slides.md -o slides.html \
|
||||
--to revealjs \
|
||||
--standalone \
|
||||
-V theme=black
|
||||
|
||||
# With custom theme
|
||||
pandoc slides.md -o slides.pdf \
|
||||
--to beamer \
|
||||
-V theme=Madrid \
|
||||
-V colortheme=dolphin
|
||||
```
|
||||
|
||||
## Using Templates
|
||||
|
||||
```bash
|
||||
# Copy template
|
||||
PLUGIN_DIR="~/.claude/marketplaces/cadrianmae-claude-marketplace/plugins/pandoc"
|
||||
cp "$PLUGIN_DIR/skills/pandoc/assets/templates/academic-paper.yaml" paper.md
|
||||
|
||||
# Copy bibliography template
|
||||
cp "$PLUGIN_DIR/skills/pandoc/assets/templates/references.bib" references.bib
|
||||
|
||||
# Copy Makefile
|
||||
cp "$PLUGIN_DIR/skills/pandoc/assets/templates/Makefile" Makefile
|
||||
```
|
||||
|
||||
## Using Defaults Files
|
||||
|
||||
```bash
|
||||
# Create defaults file
|
||||
PLUGIN_DIR="~/.claude/marketplaces/cadrianmae-claude-marketplace/plugins/pandoc"
|
||||
cp "$PLUGIN_DIR/skills/pandoc/assets/templates/defaults-pdf.yaml" defaults.yaml
|
||||
|
||||
# Use defaults
|
||||
pandoc document.md --defaults=defaults.yaml -o output.pdf
|
||||
|
||||
# Override output
|
||||
pandoc document.md --defaults=defaults.yaml -o custom-name.pdf
|
||||
```
|
||||
|
||||
## Project Setup
|
||||
|
||||
```bash
|
||||
# Create project structure
|
||||
mkdir -p project/{images,.pandoc}
|
||||
cd project
|
||||
|
||||
# Copy templates
|
||||
PLUGIN_DIR="~/.claude/marketplaces/cadrianmae-claude-marketplace/plugins/pandoc"
|
||||
cp "$PLUGIN_DIR/skills/pandoc/assets/templates/academic-paper.yaml" paper.md
|
||||
cp "$PLUGIN_DIR/skills/pandoc/assets/templates/references.bib" references.bib
|
||||
cp "$PLUGIN_DIR/skills/pandoc/assets/templates/defaults-pdf.yaml" .pandoc/defaults.yaml
|
||||
cp "$PLUGIN_DIR/skills/pandoc/assets/templates/Makefile" Makefile
|
||||
|
||||
# Setup local scripts
|
||||
make setup
|
||||
|
||||
# Build
|
||||
make
|
||||
```
|
||||
|
||||
## Batch Conversion
|
||||
|
||||
```bash
|
||||
# Convert all MD files to PDF
|
||||
for file in *.md; do
|
||||
pandoc "$file" -o "${file%.md}.pdf" --pdf-engine=pdflatex
|
||||
done
|
||||
|
||||
# With validation
|
||||
PLUGIN_DIR="~/.claude/marketplaces/cadrianmae-claude-marketplace/plugins/pandoc"
|
||||
for file in *.md; do
|
||||
if python3 "$PLUGIN_DIR/skills/pandoc/scripts/validate.py" "$file"; then
|
||||
pandoc "$file" -o "${file%.md}.pdf"
|
||||
fi
|
||||
done
|
||||
```
|
||||
|
||||
## Download Citation Styles
|
||||
|
||||
```bash
|
||||
# Harvard
|
||||
curl -o harvard.csl https://raw.githubusercontent.com/citation-style-language/styles/master/harvard-cite-them-right.csl
|
||||
|
||||
# APA
|
||||
curl -o apa.csl https://raw.githubusercontent.com/citation-style-language/styles/master/apa.csl
|
||||
|
||||
# IEEE
|
||||
curl -o ieee.csl https://raw.githubusercontent.com/citation-style-language/styles/master/ieee.csl
|
||||
|
||||
# Chicago
|
||||
curl -o chicago.csl https://raw.githubusercontent.com/citation-style-language/styles/master/chicago-author-date.csl
|
||||
```
|
||||
|
||||
## Debugging
|
||||
|
||||
```bash
|
||||
# Check Pandoc version
|
||||
pandoc --version
|
||||
|
||||
# Generate LaTeX to inspect
|
||||
pandoc doc.md -o doc.tex
|
||||
cat doc.tex
|
||||
|
||||
# Minimal test
|
||||
echo "# Test" > test.md
|
||||
pandoc test.md -o test.pdf
|
||||
|
||||
# Verbose output
|
||||
pandoc doc.md -o doc.pdf --verbose
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
```bash
|
||||
# Set plugin directory
|
||||
export PANDOC_PLUGIN_DIR="~/.claude/marketplaces/cadrianmae-claude-marketplace/plugins/pandoc"
|
||||
|
||||
# Use in commands
|
||||
python3 "$PANDOC_PLUGIN_DIR/skills/pandoc/scripts/validate.py" document.md
|
||||
```
|
||||
|
||||
## Shell Functions
|
||||
|
||||
```bash
|
||||
# Add to ~/.bashrc or ~/.zshrc
|
||||
|
||||
# Validate and convert
|
||||
pandoc-convert() {
|
||||
PLUGIN_DIR="~/.claude/marketplaces/cadrianmae-claude-marketplace/plugins/pandoc"
|
||||
python3 "$PLUGIN_DIR/skills/pandoc/scripts/validate.py" "$1" && \
|
||||
pandoc "$1" -o "$2" --pdf-engine=pdflatex --citeproc --number-sections
|
||||
}
|
||||
|
||||
# Usage: pandoc-convert paper.md paper.pdf
|
||||
|
||||
# Quick validate
|
||||
pandoc-validate() {
|
||||
PLUGIN_DIR="~/.claude/marketplaces/cadrianmae-claude-marketplace/plugins/pandoc"
|
||||
python3 "$PLUGIN_DIR/skills/pandoc/scripts/validate.py" "$1"
|
||||
}
|
||||
|
||||
# Usage: pandoc-validate document.md
|
||||
```
|
||||
|
||||
## Git Integration
|
||||
|
||||
```bash
|
||||
# .gitignore for Pandoc projects
|
||||
cat > .gitignore << 'EOF'
|
||||
# Generated files
|
||||
*.pdf
|
||||
*.html
|
||||
*.docx
|
||||
*.tex
|
||||
|
||||
# LaTeX auxiliary files
|
||||
*.aux
|
||||
*.log
|
||||
*.out
|
||||
*.toc
|
||||
|
||||
# Keep source files
|
||||
!*.md
|
||||
!*.bib
|
||||
!*.csl
|
||||
!*.yaml
|
||||
EOF
|
||||
```
|
||||
|
||||
## CI/CD (GitHub Actions)
|
||||
|
||||
```yaml
|
||||
# .github/workflows/build.yml
|
||||
name: Build Document
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install Pandoc
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y pandoc texlive-latex-base
|
||||
|
||||
- name: Build PDF
|
||||
run: |
|
||||
pandoc document.md -o document.pdf \
|
||||
--pdf-engine=pdflatex \
|
||||
--citeproc
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: document
|
||||
path: document.pdf
|
||||
```
|
||||
|
||||
## Common Patterns
|
||||
|
||||
```bash
|
||||
# Academic paper workflow
|
||||
PLUGIN_DIR="~/.claude/marketplaces/cadrianmae-claude-marketplace/plugins/pandoc"
|
||||
cp "$PLUGIN_DIR/skills/pandoc/assets/templates/academic-paper.yaml" paper.md
|
||||
# Edit paper.md
|
||||
python3 "$PLUGIN_DIR/skills/pandoc/scripts/validate.py" paper.md
|
||||
pandoc paper.md -o paper.pdf --pdf-engine=pdflatex --citeproc --number-sections
|
||||
|
||||
# Web article workflow
|
||||
pandoc article.md -o article.html --standalone --toc --css=style.css
|
||||
|
||||
# Presentation workflow
|
||||
cp "$PLUGIN_DIR/skills/pandoc/assets/templates/presentation-revealjs.yaml" slides.md
|
||||
# Edit slides.md
|
||||
pandoc slides.md -o slides.html --to revealjs --standalone
|
||||
```
|
||||
462
skills/pandoc/references/templates_guide.md
Normal file
462
skills/pandoc/references/templates_guide.md
Normal file
@@ -0,0 +1,462 @@
|
||||
# Pandoc Templates Guide
|
||||
|
||||
How to use and customize Pandoc document templates.
|
||||
|
||||
## Available Templates
|
||||
|
||||
### 1. academic-paper.yaml
|
||||
**Purpose:** Academic papers with citations
|
||||
**Features:**
|
||||
- Bibliography support
|
||||
- Citation style (CSL)
|
||||
- Standard academic formatting
|
||||
- Table of contents
|
||||
|
||||
**Best for:** Research papers, essays, academic assignments
|
||||
|
||||
### 2. thesis-report.yaml
|
||||
**Purpose:** Thesis and long-form reports
|
||||
**Features:**
|
||||
- Custom title page
|
||||
- Supervisor/institution fields
|
||||
- List of figures/tables
|
||||
- Chapter-based structure
|
||||
- Declaration section
|
||||
|
||||
**Best for:** Final year projects, dissertations, technical reports
|
||||
|
||||
### 3. presentation-beamer.yaml
|
||||
**Purpose:** PDF presentations via LaTeX Beamer
|
||||
**Features:**
|
||||
- Slide themes
|
||||
- Code highlighting
|
||||
- Incremental reveals
|
||||
- Speaker notes
|
||||
|
||||
**Best for:** Academic presentations, lectures, conferences
|
||||
|
||||
### 4. presentation-revealjs.yaml
|
||||
**Purpose:** Web-based presentations
|
||||
**Features:**
|
||||
- Modern web slides
|
||||
- Transitions and animations
|
||||
- Two-column layouts
|
||||
- Background images
|
||||
- Fragment animations
|
||||
|
||||
**Best for:** Web presentations, online seminars, interactive slides
|
||||
|
||||
### 5. article-simple.yaml
|
||||
**Purpose:** Quick, minimal documents
|
||||
**Features:**
|
||||
- Basic metadata only
|
||||
- Fast compilation
|
||||
- Minimal configuration
|
||||
|
||||
**Best for:** Quick notes, simple documents, drafts
|
||||
|
||||
### 6. defaults-pdf.yaml
|
||||
**Purpose:** Reusable defaults file
|
||||
**Features:**
|
||||
- Consistent settings across documents
|
||||
- Project-wide configuration
|
||||
- Override-able options
|
||||
|
||||
**Best for:** Multi-document projects, team collaboration
|
||||
|
||||
### 7. references.bib
|
||||
**Purpose:** BibTeX bibliography template
|
||||
**Features:**
|
||||
- Example entries for all common types
|
||||
- Field reference guide
|
||||
- Formatting instructions
|
||||
|
||||
**Best for:** Citation management, bibliography creation
|
||||
|
||||
## Using Templates
|
||||
|
||||
### Method 1: Copy to New File
|
||||
|
||||
```bash
|
||||
PLUGIN_DIR="~/.claude/marketplaces/cadrianmae-claude-marketplace/plugins/pandoc"
|
||||
cp "$PLUGIN_DIR/skills/pandoc/assets/templates/academic-paper.yaml" paper.md
|
||||
```
|
||||
|
||||
### Method 2: User Command
|
||||
|
||||
```bash
|
||||
/pandoc:template academic-paper paper.md
|
||||
```
|
||||
|
||||
### Method 3: View Then Create
|
||||
|
||||
```bash
|
||||
# View template first
|
||||
/pandoc:template academic-paper
|
||||
|
||||
# Then create when ready
|
||||
/pandoc:template academic-paper paper.md
|
||||
```
|
||||
|
||||
## Customizing Templates
|
||||
|
||||
### 1. Edit Metadata Fields
|
||||
|
||||
Replace placeholder values:
|
||||
```yaml
|
||||
title: "Your Paper Title" # Change this
|
||||
author: "Your Name" # Change this
|
||||
date: "November 2024" # Change this
|
||||
```
|
||||
|
||||
### 2. Add Custom Fields
|
||||
|
||||
```yaml
|
||||
# Add to existing frontmatter
|
||||
student-id: "C21348423"
|
||||
module: "COMP4060"
|
||||
supervisor: "Dr. Smith"
|
||||
```
|
||||
|
||||
### 3. Modify Formatting
|
||||
|
||||
```yaml
|
||||
# Change document appearance
|
||||
fontsize: 11pt # Was 12pt
|
||||
geometry: margin=1.5in # Was 1in
|
||||
linestretch: 2.0 # Was 1.5 (now double-spaced)
|
||||
```
|
||||
|
||||
### 4. Bibliography Settings
|
||||
|
||||
```yaml
|
||||
# Change citation style
|
||||
csl: apa.csl # Was harvard.csl
|
||||
|
||||
# Add multiple bibliography files
|
||||
bibliography:
|
||||
- references.bib
|
||||
- additional.bib
|
||||
```
|
||||
|
||||
### 5. LaTeX Customization
|
||||
|
||||
```yaml
|
||||
header-includes: |
|
||||
\usepackage{graphicx}
|
||||
\usepackage{custom-package}
|
||||
\newcommand{\mycommand}{text}
|
||||
```
|
||||
|
||||
## Creating Custom Templates
|
||||
|
||||
### Step 1: Start from Existing
|
||||
|
||||
```bash
|
||||
PLUGIN_DIR="~/.claude/marketplaces/cadrianmae-claude-marketplace/plugins/pandoc"
|
||||
|
||||
# Copy closest match
|
||||
cp "$PLUGIN_DIR/skills/pandoc/assets/templates/academic-paper.yaml" my-template.yaml
|
||||
```
|
||||
|
||||
### Step 2: Customize Frontmatter
|
||||
|
||||
Edit `my-template.yaml`:
|
||||
```yaml
|
||||
---
|
||||
# Your custom fields
|
||||
title: "Template Title"
|
||||
custom-field: "Custom Value"
|
||||
|
||||
# Your formatting preferences
|
||||
documentclass: report
|
||||
fontsize: 12pt
|
||||
geometry: "left=1.5in, right=1in"
|
||||
linestretch: 1.5
|
||||
|
||||
# Your packages
|
||||
header-includes: |
|
||||
\usepackage{custom}
|
||||
---
|
||||
|
||||
# Template Content
|
||||
|
||||
Your template content here.
|
||||
```
|
||||
|
||||
### Step 3: Save for Reuse
|
||||
|
||||
```bash
|
||||
# Save in project
|
||||
mkdir -p .pandoc/templates/
|
||||
mv my-template.yaml .pandoc/templates/
|
||||
|
||||
# Use it
|
||||
cp .pandoc/templates/my-template.yaml new-document.md
|
||||
```
|
||||
|
||||
## Template Inheritance
|
||||
|
||||
### Using Defaults Files
|
||||
|
||||
Create base configuration:
|
||||
|
||||
**.pandoc/base.yaml:**
|
||||
```yaml
|
||||
from: markdown
|
||||
to: pdf
|
||||
pdf-engine: pdflatex
|
||||
|
||||
metadata:
|
||||
lang: en-GB
|
||||
fontsize: 12pt
|
||||
geometry: margin=1in
|
||||
```
|
||||
|
||||
**Use in document:**
|
||||
```bash
|
||||
pandoc document.md --defaults=.pandoc/base.yaml -o output.pdf
|
||||
```
|
||||
|
||||
### Layered Defaults
|
||||
|
||||
**Base settings:**
|
||||
```yaml
|
||||
# .pandoc/base.yaml
|
||||
metadata:
|
||||
fontsize: 12pt
|
||||
lang: en-GB
|
||||
```
|
||||
|
||||
**Citation settings:**
|
||||
```yaml
|
||||
# .pandoc/citations.yaml
|
||||
citeproc: true
|
||||
metadata:
|
||||
link-citations: true
|
||||
```
|
||||
|
||||
**Combine:**
|
||||
```bash
|
||||
pandoc doc.md \
|
||||
--defaults=.pandoc/base.yaml \
|
||||
--defaults=.pandoc/citations.yaml \
|
||||
-o output.pdf
|
||||
```
|
||||
|
||||
## Project Templates
|
||||
|
||||
### Academic Project Structure
|
||||
|
||||
```
|
||||
project/
|
||||
├── .pandoc/
|
||||
│ ├── defaults.yaml # Project-wide settings
|
||||
│ ├── templates/
|
||||
│ │ ├── chapter.yaml # Chapter template
|
||||
│ │ └── appendix.yaml # Appendix template
|
||||
│ └── filters/
|
||||
│ └── custom.lua # Custom filters
|
||||
├── chapters/
|
||||
│ ├── chapter1.md
|
||||
│ ├── chapter2.md
|
||||
│ └── chapter3.md
|
||||
├── references.bib
|
||||
├── harvard.csl
|
||||
└── Makefile
|
||||
```
|
||||
|
||||
### Makefile for Project
|
||||
|
||||
```makefile
|
||||
# Variables
|
||||
PANDOC = pandoc
|
||||
DEFAULTS = .pandoc/defaults.yaml
|
||||
CHAPTERS = chapters/*.md
|
||||
OUTPUT = thesis.pdf
|
||||
|
||||
# Main targets
|
||||
all: $(OUTPUT)
|
||||
|
||||
$(OUTPUT): $(CHAPTERS) references.bib
|
||||
$(PANDOC) $(CHAPTERS) \
|
||||
--defaults=$(DEFAULTS) \
|
||||
-o $(OUTPUT)
|
||||
|
||||
# Individual chapters
|
||||
chapter%.pdf: chapters/chapter%.md
|
||||
$(PANDOC) $< \
|
||||
--defaults=$(DEFAULTS) \
|
||||
-o $@
|
||||
|
||||
# Clean
|
||||
clean:
|
||||
rm -f *.pdf
|
||||
|
||||
# Help
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
@echo " all - Build complete thesis"
|
||||
@echo " chapter%.pdf - Build individual chapter"
|
||||
@echo " clean - Remove generated PDFs"
|
||||
|
||||
.PHONY: all clean help
|
||||
```
|
||||
|
||||
**Usage:**
|
||||
```bash
|
||||
make # Build thesis
|
||||
make chapter1.pdf # Build chapter 1 only
|
||||
make clean # Remove PDFs
|
||||
```
|
||||
|
||||
## Template Best Practices
|
||||
|
||||
### 1. Use Placeholders
|
||||
|
||||
```yaml
|
||||
title: "Document Title" # Clear what to change
|
||||
author: "Author Name" # Not "TODO" or "FILL IN"
|
||||
date: "Date" # Simple placeholder
|
||||
```
|
||||
|
||||
### 2. Include Comments
|
||||
|
||||
```yaml
|
||||
documentclass: report # Options: article, report, book
|
||||
fontsize: 12pt # Options: 10pt, 11pt, 12pt
|
||||
geometry: margin=1in # Or: margin=2cm, left=1.5in
|
||||
```
|
||||
|
||||
### 3. Provide Examples
|
||||
|
||||
```yaml
|
||||
# Single author
|
||||
author: "Author Name"
|
||||
|
||||
# Multiple authors
|
||||
# author:
|
||||
# - "First Author"
|
||||
# - "Second Author"
|
||||
```
|
||||
|
||||
### 4. Set Sensible Defaults
|
||||
|
||||
```yaml
|
||||
lang: en-GB # British English
|
||||
fontsize: 12pt # Standard academic
|
||||
geometry: margin=1in # Standard margins
|
||||
linestretch: 1.5 # Standard spacing
|
||||
```
|
||||
|
||||
### 5. Document Requirements
|
||||
|
||||
```yaml
|
||||
# Required files for this template:
|
||||
# - references.bib (bibliography)
|
||||
# - harvard.csl (citation style)
|
||||
# - logo.png (if using custom title page)
|
||||
```
|
||||
|
||||
## Troubleshooting Templates
|
||||
|
||||
### Template Won't Convert
|
||||
|
||||
**Check:**
|
||||
1. YAML syntax (spaces not tabs)
|
||||
2. Required files exist
|
||||
3. Field names spelled correctly
|
||||
4. Values properly quoted
|
||||
|
||||
**Validate:**
|
||||
```bash
|
||||
PLUGIN_DIR="~/.claude/marketplaces/cadrianmae-claude-marketplace/plugins/pandoc"
|
||||
python3 "$PLUGIN_DIR/skills/pandoc/scripts/validate.py" template.md
|
||||
```
|
||||
|
||||
### Custom Fields Not Working
|
||||
|
||||
Some fields are LaTeX-specific:
|
||||
```yaml
|
||||
# Works in PDF
|
||||
geometry: margin=1in
|
||||
|
||||
# Doesn't work in HTML/DOCX
|
||||
# Use CSS for HTML instead
|
||||
```
|
||||
|
||||
### Bibliography Issues
|
||||
|
||||
**Ensure:**
|
||||
```yaml
|
||||
bibliography: references.bib # File exists
|
||||
csl: harvard.csl # File exists
|
||||
```
|
||||
|
||||
**Then convert with:**
|
||||
```bash
|
||||
pandoc doc.md -o doc.pdf --citeproc
|
||||
```
|
||||
|
||||
## Advanced Customization
|
||||
|
||||
### Custom LaTeX Template
|
||||
|
||||
**Create template.tex:**
|
||||
```latex
|
||||
\documentclass{$documentclass$}
|
||||
|
||||
% Packages
|
||||
$for(header-includes)$
|
||||
$header-includes$
|
||||
$endfor$
|
||||
|
||||
\title{$title$}
|
||||
\author{$author$}
|
||||
\date{$date$}
|
||||
|
||||
\begin{document}
|
||||
\maketitle
|
||||
|
||||
$body$
|
||||
|
||||
\end{document}
|
||||
```
|
||||
|
||||
**Use template:**
|
||||
```bash
|
||||
pandoc doc.md -o doc.pdf --template=template.tex
|
||||
```
|
||||
|
||||
### Conditional Content
|
||||
|
||||
```yaml
|
||||
# In frontmatter
|
||||
draft: true
|
||||
```
|
||||
|
||||
```markdown
|
||||
<!-- In document -->
|
||||
$if(draft)$
|
||||
**DRAFT VERSION**
|
||||
$endif$
|
||||
```
|
||||
|
||||
### Variables in Content
|
||||
|
||||
**Frontmatter:**
|
||||
```yaml
|
||||
institution: "University Name"
|
||||
```
|
||||
|
||||
**Content:**
|
||||
```markdown
|
||||
This research was conducted at $institution$.
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
- **Pandoc Templates:** https://pandoc.org/MANUAL.html#templates
|
||||
- **Template Variables:** https://pandoc.org/MANUAL.html#variables
|
||||
- **LaTeX Templates:** https://www.latextemplates.com/
|
||||
- **CSL Styles:** https://github.com/citation-style-language/styles
|
||||
526
skills/pandoc/references/troubleshooting.md
Normal file
526
skills/pandoc/references/troubleshooting.md
Normal file
@@ -0,0 +1,526 @@
|
||||
# Pandoc Troubleshooting Guide
|
||||
|
||||
Common errors and solutions for Pandoc document conversion.
|
||||
|
||||
## YAML Frontmatter Errors
|
||||
|
||||
### Error: YAML syntax error
|
||||
|
||||
**Problem:** Invalid YAML in frontmatter
|
||||
```
|
||||
Error: YAML syntax error: mapping values are not allowed here
|
||||
```
|
||||
|
||||
**Common Causes:**
|
||||
1. **Tabs instead of spaces**
|
||||
```yaml
|
||||
# ❌ Wrong (contains tabs)
|
||||
title:→"My Paper"
|
||||
|
||||
# ✅ Correct (spaces only)
|
||||
title: "My Paper"
|
||||
```
|
||||
|
||||
2. **Missing quotes around special characters**
|
||||
```yaml
|
||||
# ❌ Wrong
|
||||
title: Paper: A Study
|
||||
|
||||
# ✅ Correct
|
||||
title: "Paper: A Study"
|
||||
```
|
||||
|
||||
3. **Incorrect indentation**
|
||||
```yaml
|
||||
# ❌ Wrong
|
||||
author:
|
||||
- "Name" # Should be indented
|
||||
|
||||
# ✅ Correct
|
||||
author:
|
||||
- "Name"
|
||||
```
|
||||
|
||||
**Fix:** Use validation to find exact error
|
||||
```bash
|
||||
PLUGIN_DIR="~/.claude/marketplaces/cadrianmae-claude-marketplace/plugins/pandoc"
|
||||
python3 "$PLUGIN_DIR/skills/pandoc/scripts/validate.py" document.md
|
||||
```
|
||||
|
||||
### Error: YAML not properly closed
|
||||
|
||||
**Problem:** Missing second `---` marker
|
||||
```
|
||||
Error: YAML frontmatter not properly closed (missing second '---')
|
||||
```
|
||||
|
||||
**Fix:**
|
||||
```yaml
|
||||
---
|
||||
title: "Paper"
|
||||
author: "Name"
|
||||
--- # Must have this!
|
||||
|
||||
# Content starts here
|
||||
```
|
||||
|
||||
## Bibliography Errors
|
||||
|
||||
### Error: Bibliography file not found
|
||||
|
||||
**Problem:** `.bib` file doesn't exist or wrong path
|
||||
```
|
||||
Error: Bibliography file not found: references.bib
|
||||
```
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Create bibliography file:**
|
||||
```bash
|
||||
PLUGIN_DIR="~/.claude/marketplaces/cadrianmae-claude-marketplace/plugins/pandoc"
|
||||
cp "$PLUGIN_DIR/skills/pandoc/assets/templates/references.bib" references.bib
|
||||
```
|
||||
|
||||
2. **Fix path in frontmatter:**
|
||||
```yaml
|
||||
# ❌ Wrong (absolute path from another location)
|
||||
bibliography: /old/location/refs.bib
|
||||
|
||||
# ✅ Correct (relative path)
|
||||
bibliography: references.bib
|
||||
bibliography: ./refs/references.bib
|
||||
```
|
||||
|
||||
3. **Check file actually exists:**
|
||||
```bash
|
||||
ls -la references.bib
|
||||
```
|
||||
|
||||
### Error: CSL file not found
|
||||
|
||||
**Problem:** Citation style file missing
|
||||
```
|
||||
Error: CSL file not found: harvard.csl
|
||||
```
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Download CSL file:**
|
||||
```bash
|
||||
# Harvard style
|
||||
curl -o harvard.csl https://raw.githubusercontent.com/citation-style-language/styles/master/harvard-cite-them-right.csl
|
||||
|
||||
# APA style
|
||||
curl -o apa.csl https://raw.githubusercontent.com/citation-style-language/styles/master/apa.csl
|
||||
|
||||
# IEEE style
|
||||
curl -o ieee.csl https://raw.githubusercontent.com/citation-style-language/styles/master/ieee.csl
|
||||
```
|
||||
|
||||
2. **Browse all styles:**
|
||||
https://github.com/citation-style-language/styles
|
||||
|
||||
3. **Remove CSL if using default:**
|
||||
```yaml
|
||||
bibliography: references.bib
|
||||
# csl: harvard.csl # Comment out to use default
|
||||
```
|
||||
|
||||
### Error: BibTeX parse error
|
||||
|
||||
**Problem:** Invalid BibTeX syntax in `.bib` file
|
||||
|
||||
**Common Issues:**
|
||||
|
||||
1. **Missing commas:**
|
||||
```bibtex
|
||||
# ❌ Wrong
|
||||
@article{key,
|
||||
author = "Name"
|
||||
title = "Title" # Missing comma after author
|
||||
}
|
||||
|
||||
# ✅ Correct
|
||||
@article{key,
|
||||
author = "Name", # Comma added
|
||||
title = "Title"
|
||||
}
|
||||
```
|
||||
|
||||
2. **Unclosed braces:**
|
||||
```bibtex
|
||||
# ❌ Wrong
|
||||
@article{key,
|
||||
title = {Unclosed brace
|
||||
}
|
||||
|
||||
# ✅ Correct
|
||||
@article{key,
|
||||
title = {Closed brace}
|
||||
}
|
||||
```
|
||||
|
||||
3. **Invalid characters in cite key:**
|
||||
```bibtex
|
||||
# ❌ Wrong
|
||||
@article{smith&jones2024,
|
||||
|
||||
# ✅ Correct
|
||||
@article{smith-jones-2024,
|
||||
```
|
||||
|
||||
## PDF Generation Errors
|
||||
|
||||
### Error: ! LaTeX Error: File not found
|
||||
|
||||
**Problem:** Missing LaTeX packages
|
||||
|
||||
**Solution:**
|
||||
```bash
|
||||
# Fedora/RHEL
|
||||
sudo dnf install texlive-scheme-medium
|
||||
|
||||
# Ubuntu/Debian
|
||||
sudo apt-get install texlive-latex-base texlive-latex-extra texlive-fonts-recommended
|
||||
|
||||
# macOS
|
||||
brew install --cask mactex
|
||||
```
|
||||
|
||||
### Error: Unicode characters not supported
|
||||
|
||||
**Problem:** Using pdflatex with Unicode
|
||||
```
|
||||
! Package inputenc Error: Unicode character ... not set up for use with LaTeX
|
||||
```
|
||||
|
||||
**Solution:** Use XeLaTeX instead
|
||||
```bash
|
||||
pandoc document.md -o document.pdf --pdf-engine=xelatex
|
||||
```
|
||||
|
||||
Or update frontmatter:
|
||||
```yaml
|
||||
# Add to defaults file
|
||||
pdf-engine: xelatex
|
||||
```
|
||||
|
||||
### Error: Missing fonts
|
||||
|
||||
**Problem:** Custom font not found
|
||||
```
|
||||
! Font ... not found
|
||||
```
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Use standard fonts:**
|
||||
```yaml
|
||||
# Remove custom fonts
|
||||
# mainfont: "Custom Font"
|
||||
```
|
||||
|
||||
2. **Install font:**
|
||||
```bash
|
||||
# Copy font to system
|
||||
sudo cp font.ttf /usr/share/fonts/
|
||||
sudo fc-cache -f -v
|
||||
```
|
||||
|
||||
3. **Use XeLaTeX with system fonts:**
|
||||
```yaml
|
||||
mainfont: "Times New Roman" # Must use XeLaTeX
|
||||
```
|
||||
|
||||
### Error: ! Package geometry Error
|
||||
|
||||
**Problem:** Invalid geometry specification
|
||||
```
|
||||
! Package geometry Error: ... is too large
|
||||
```
|
||||
|
||||
**Fix:**
|
||||
```yaml
|
||||
# ❌ Wrong
|
||||
geometry: margin=5in # Too large for paper
|
||||
|
||||
# ✅ Correct
|
||||
geometry: margin=1in
|
||||
geometry: "left=1.5in, right=1in, top=1in, bottom=1in"
|
||||
```
|
||||
|
||||
## Image Errors
|
||||
|
||||
### Error: Image file not found
|
||||
|
||||
**Problem:** Image path incorrect or file missing
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Use relative paths:**
|
||||
```markdown
|
||||
# ❌ Wrong (absolute path from different location)
|
||||

|
||||
|
||||
# ✅ Correct
|
||||

|
||||

|
||||
```
|
||||
|
||||
2. **Check file exists:**
|
||||
```bash
|
||||
ls -la images/figure1.png
|
||||
```
|
||||
|
||||
3. **Create images directory:**
|
||||
```bash
|
||||
mkdir -p images
|
||||
# Copy images there
|
||||
```
|
||||
|
||||
### Error: Image format not supported
|
||||
|
||||
**Problem:** LaTeX can't handle certain formats
|
||||
|
||||
**Supported formats:**
|
||||
- PDF: PNG, JPEG, PDF
|
||||
- HTML: PNG, JPEG, GIF, SVG
|
||||
|
||||
**Solution:** Convert image format
|
||||
```bash
|
||||
# Convert SVG to PNG (for PDF output)
|
||||
convert diagram.svg diagram.png
|
||||
|
||||
# Or use ImageMagick
|
||||
magick convert image.tiff image.png
|
||||
```
|
||||
|
||||
## Conversion Errors
|
||||
|
||||
### Error: Pandoc not found
|
||||
|
||||
**Problem:** Pandoc not installed or not in PATH
|
||||
```
|
||||
Error: pandoc: command not found
|
||||
```
|
||||
|
||||
**Solution:**
|
||||
```bash
|
||||
# Fedora/RHEL
|
||||
sudo dnf install pandoc
|
||||
|
||||
# Ubuntu/Debian
|
||||
sudo apt-get install pandoc
|
||||
|
||||
# macOS
|
||||
brew install pandoc
|
||||
|
||||
# Verify installation
|
||||
pandoc --version
|
||||
```
|
||||
|
||||
### Error: Python not found (validation)
|
||||
|
||||
**Problem:** Python3 not available
|
||||
```
|
||||
Error: python3: command not found
|
||||
```
|
||||
|
||||
**Solution:**
|
||||
```bash
|
||||
# Most Linux distributions have Python3
|
||||
# But if not:
|
||||
sudo dnf install python3
|
||||
|
||||
# Or use python instead of python3
|
||||
python --version # Check if Python 3.x
|
||||
```
|
||||
|
||||
### Error: YAML module not found
|
||||
|
||||
**Problem:** PyYAML not installed (for validation)
|
||||
```
|
||||
ModuleNotFoundError: No module named 'yaml'
|
||||
```
|
||||
|
||||
**Solution:**
|
||||
```bash
|
||||
pip3 install pyyaml
|
||||
|
||||
# Or system package
|
||||
sudo dnf install python3-pyyaml
|
||||
```
|
||||
|
||||
## Output Errors
|
||||
|
||||
### Error: Permission denied writing output
|
||||
|
||||
**Problem:** Can't write to output location
|
||||
```
|
||||
Error: output.pdf: Permission denied
|
||||
```
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Check write permissions:**
|
||||
```bash
|
||||
ls -la output.pdf # Check if file locked
|
||||
```
|
||||
|
||||
2. **Use different location:**
|
||||
```bash
|
||||
pandoc doc.md -o ~/Documents/output.pdf
|
||||
```
|
||||
|
||||
3. **Close file in other program:**
|
||||
- Close PDF viewer
|
||||
- Close Word
|
||||
- Close text editor
|
||||
|
||||
### Error: Disk full
|
||||
|
||||
**Problem:** No space for output file
|
||||
|
||||
**Check:**
|
||||
```bash
|
||||
df -h . # Check disk space
|
||||
```
|
||||
|
||||
**Solution:**
|
||||
- Free up disk space
|
||||
- Use different output location
|
||||
|
||||
## Performance Issues
|
||||
|
||||
### Slow Conversion
|
||||
|
||||
**Causes:**
|
||||
1. Large document
|
||||
2. Many images
|
||||
3. Complex LaTeX
|
||||
4. Slow PDF engine
|
||||
|
||||
**Solutions:**
|
||||
|
||||
1. **Use faster engine:**
|
||||
```bash
|
||||
# pdflatex is fastest
|
||||
pandoc doc.md -o doc.pdf --pdf-engine=pdflatex
|
||||
```
|
||||
|
||||
2. **Optimize images:**
|
||||
```bash
|
||||
# Compress images before embedding
|
||||
convert large.png -resize 50% smaller.png
|
||||
```
|
||||
|
||||
3. **Split large documents:**
|
||||
```bash
|
||||
# Convert chapters separately
|
||||
pandoc chapter1.md -o chapter1.pdf
|
||||
pandoc chapter2.md -o chapter2.pdf
|
||||
```
|
||||
|
||||
## Citation Issues
|
||||
|
||||
### Citations not appearing
|
||||
|
||||
**Checklist:**
|
||||
1. ✅ Bibliography file exists
|
||||
2. ✅ CSL file exists (or using default)
|
||||
3. ✅ Using `--citeproc` flag
|
||||
4. ✅ Citation keys match bibliography
|
||||
|
||||
**Validate:**
|
||||
```bash
|
||||
PLUGIN_DIR="~/.claude/marketplaces/cadrianmae-claude-marketplace/plugins/pandoc"
|
||||
python3 "$PLUGIN_DIR/skills/pandoc/scripts/validate.py" document.md
|
||||
```
|
||||
|
||||
**Check citation syntax:**
|
||||
```markdown
|
||||
# ✅ Correct
|
||||
[@smith2024]
|
||||
@jones2023 found that...
|
||||
|
||||
# ❌ Wrong
|
||||
[smith2024] # Missing @
|
||||
```
|
||||
|
||||
### Wrong citation style
|
||||
|
||||
**Problem:** Citations not in expected format
|
||||
|
||||
**Solution:** Use correct CSL file
|
||||
```yaml
|
||||
csl: harvard.csl # Harvard
|
||||
csl: apa.csl # APA
|
||||
csl: ieee.csl # IEEE
|
||||
```
|
||||
|
||||
**Download styles:**
|
||||
```bash
|
||||
curl -o style.csl https://raw.githubusercontent.com/citation-style-language/styles/master/[style-name].csl
|
||||
```
|
||||
|
||||
## Debug Workflow
|
||||
|
||||
### Step-by-Step Debugging
|
||||
|
||||
1. **Validate first:**
|
||||
```bash
|
||||
PLUGIN_DIR="~/.claude/marketplaces/cadrianmae-claude-marketplace/plugins/pandoc"
|
||||
python3 "$PLUGIN_DIR/skills/pandoc/scripts/validate.py" document.md
|
||||
```
|
||||
|
||||
2. **Check Pandoc version:**
|
||||
```bash
|
||||
pandoc --version
|
||||
# Ensure version 2.0+
|
||||
```
|
||||
|
||||
3. **Test minimal conversion:**
|
||||
```bash
|
||||
# Create minimal test
|
||||
echo "# Test" > test.md
|
||||
pandoc test.md -o test.pdf
|
||||
```
|
||||
|
||||
4. **Add options incrementally:**
|
||||
```bash
|
||||
# Start simple
|
||||
pandoc doc.md -o doc.pdf
|
||||
|
||||
# Add engine
|
||||
pandoc doc.md -o doc.pdf --pdf-engine=pdflatex
|
||||
|
||||
# Add citations
|
||||
pandoc doc.md -o doc.pdf --pdf-engine=pdflatex --citeproc
|
||||
```
|
||||
|
||||
5. **Check LaTeX intermediate:**
|
||||
```bash
|
||||
# Generate .tex file to see LaTeX
|
||||
pandoc doc.md -o doc.tex
|
||||
cat doc.tex # Inspect for errors
|
||||
```
|
||||
|
||||
## Get Help
|
||||
|
||||
### Pandoc Documentation
|
||||
- Manual: https://pandoc.org/MANUAL.html
|
||||
- FAQ: https://pandoc.org/faqs.html
|
||||
- Demos: https://pandoc.org/demos.html
|
||||
|
||||
### Community Resources
|
||||
- Pandoc Discussions: https://github.com/jgm/pandoc/discussions
|
||||
- Stack Overflow: [pandoc] tag
|
||||
- LaTeX Stack Exchange: https://tex.stackexchange.com/
|
||||
|
||||
### Validation Tool
|
||||
```bash
|
||||
PLUGIN_DIR="~/.claude/marketplaces/cadrianmae-claude-marketplace/plugins/pandoc"
|
||||
python3 "$PLUGIN_DIR/skills/pandoc/scripts/validate.py" document.md
|
||||
```
|
||||
|
||||
This tool catches most common errors before conversion.
|
||||
579
skills/pandoc/references/yaml_reference.md
Normal file
579
skills/pandoc/references/yaml_reference.md
Normal file
@@ -0,0 +1,579 @@
|
||||
# Pandoc YAML Variables Reference
|
||||
|
||||
Comprehensive guide to YAML frontmatter variables for Pandoc document conversion.
|
||||
|
||||
## Core Metadata
|
||||
|
||||
### title
|
||||
**Type:** String
|
||||
**Usage:** Document title
|
||||
**Example:**
|
||||
```yaml
|
||||
title: "My Research Paper"
|
||||
```
|
||||
|
||||
### author
|
||||
**Type:** String or List
|
||||
**Usage:** Author name(s)
|
||||
**Examples:**
|
||||
```yaml
|
||||
author: "John Smith"
|
||||
|
||||
# Multiple authors
|
||||
author:
|
||||
- "John Smith"
|
||||
- "Jane Doe"
|
||||
```
|
||||
|
||||
### date
|
||||
**Type:** String
|
||||
**Usage:** Publication/document date
|
||||
**Examples:**
|
||||
```yaml
|
||||
date: "November 2024"
|
||||
date: "2024-11-16"
|
||||
date: "16 November 2024"
|
||||
```
|
||||
|
||||
### lang
|
||||
**Type:** String (BCP 47 language code)
|
||||
**Usage:** Document language for hyphenation, quotes, citations
|
||||
**Examples:**
|
||||
```yaml
|
||||
lang: en-GB # British English
|
||||
lang: en-US # American English
|
||||
lang: en-IE # Irish English
|
||||
lang: de # German
|
||||
lang: fr # French
|
||||
```
|
||||
|
||||
## Bibliography and Citations
|
||||
|
||||
### bibliography
|
||||
**Type:** String or List
|
||||
**Usage:** Path to BibTeX (.bib) file(s)
|
||||
**Examples:**
|
||||
```yaml
|
||||
bibliography: references.bib
|
||||
|
||||
# Multiple files
|
||||
bibliography:
|
||||
- references.bib
|
||||
- additional.bib
|
||||
```
|
||||
|
||||
### csl
|
||||
**Type:** String
|
||||
**Usage:** Path to Citation Style Language (.csl) file
|
||||
**Examples:**
|
||||
```yaml
|
||||
csl: harvard.csl
|
||||
csl: apa.csl
|
||||
csl: ieee.csl
|
||||
```
|
||||
|
||||
**Download CSL styles:** https://github.com/citation-style-language/styles
|
||||
|
||||
### link-citations
|
||||
**Type:** Boolean
|
||||
**Usage:** Make citations clickable links to bibliography
|
||||
**Example:**
|
||||
```yaml
|
||||
link-citations: true
|
||||
```
|
||||
|
||||
### citeproc
|
||||
**Type:** Boolean (command-line option, not frontmatter)
|
||||
**Usage:** Enable citation processing
|
||||
**Command:**
|
||||
```bash
|
||||
pandoc doc.md -o doc.pdf --citeproc
|
||||
```
|
||||
|
||||
## PDF Output Settings
|
||||
|
||||
### documentclass
|
||||
**Type:** String
|
||||
**Usage:** LaTeX document class
|
||||
**Options:**
|
||||
- `article` - Short documents, papers
|
||||
- `report` - Longer documents with chapters
|
||||
- `book` - Books with front matter
|
||||
- `beamer` - Presentations
|
||||
|
||||
**Example:**
|
||||
```yaml
|
||||
documentclass: report
|
||||
```
|
||||
|
||||
### fontsize
|
||||
**Type:** String
|
||||
**Usage:** Base font size
|
||||
**Options:** `10pt`, `11pt`, `12pt`
|
||||
**Example:**
|
||||
```yaml
|
||||
fontsize: 12pt
|
||||
```
|
||||
|
||||
### geometry
|
||||
**Type:** String
|
||||
**Usage:** Page layout and margins
|
||||
**Examples:**
|
||||
```yaml
|
||||
geometry: margin=1in
|
||||
geometry: margin=2cm
|
||||
geometry: "left=1.5in, right=1in, top=1in, bottom=1in"
|
||||
geometry: "a4paper, margin=2.5cm"
|
||||
```
|
||||
|
||||
### linestretch
|
||||
**Type:** Number
|
||||
**Usage:** Line spacing multiplier
|
||||
**Examples:**
|
||||
```yaml
|
||||
linestretch: 1.0 # Single spacing
|
||||
linestretch: 1.5 # 1.5 spacing
|
||||
linestretch: 2.0 # Double spacing
|
||||
```
|
||||
|
||||
### papersize
|
||||
**Type:** String
|
||||
**Usage:** Paper size
|
||||
**Options:** `a4`, `letter`, `legal`, `executive`
|
||||
**Example:**
|
||||
```yaml
|
||||
papersize: a4
|
||||
```
|
||||
|
||||
## Table of Contents
|
||||
|
||||
### toc
|
||||
**Type:** Boolean
|
||||
**Usage:** Include table of contents
|
||||
**Example:**
|
||||
```yaml
|
||||
toc: true
|
||||
```
|
||||
|
||||
### toc-depth
|
||||
**Type:** Integer (1-5)
|
||||
**Usage:** Maximum heading level in TOC
|
||||
**Example:**
|
||||
```yaml
|
||||
toc-depth: 3 # Include h1, h2, h3
|
||||
```
|
||||
|
||||
### toc-title
|
||||
**Type:** String
|
||||
**Usage:** Custom TOC heading
|
||||
**Example:**
|
||||
```yaml
|
||||
toc-title: "Contents"
|
||||
```
|
||||
|
||||
### lof
|
||||
**Type:** Boolean
|
||||
**Usage:** Include list of figures
|
||||
**Example:**
|
||||
```yaml
|
||||
lof: true
|
||||
```
|
||||
|
||||
### lot
|
||||
**Type:** Boolean
|
||||
**Usage:** Include list of tables
|
||||
**Example:**
|
||||
```yaml
|
||||
lot: true
|
||||
```
|
||||
|
||||
## Section Numbering
|
||||
|
||||
### numbersections
|
||||
**Type:** Boolean
|
||||
**Usage:** Number section headings automatically
|
||||
**Example:**
|
||||
```yaml
|
||||
numbersections: true
|
||||
```
|
||||
|
||||
### secnumdepth
|
||||
**Type:** Integer
|
||||
**Usage:** Maximum heading level to number
|
||||
**Example:**
|
||||
```yaml
|
||||
secnumdepth: 3 # Number up to h3
|
||||
```
|
||||
|
||||
## LaTeX Customization
|
||||
|
||||
### header-includes
|
||||
**Type:** String (multiline)
|
||||
**Usage:** Custom LaTeX commands and packages
|
||||
**Example:**
|
||||
```yaml
|
||||
header-includes: |
|
||||
\usepackage{graphicx}
|
||||
\usepackage{float}
|
||||
\usepackage{hyperref}
|
||||
\usepackage{amsmath}
|
||||
```
|
||||
|
||||
### include-before
|
||||
**Type:** String (multiline)
|
||||
**Usage:** Content before document body
|
||||
**Example:**
|
||||
```yaml
|
||||
include-before: |
|
||||
\begin{abstract}
|
||||
This is the abstract.
|
||||
\end{abstract}
|
||||
```
|
||||
|
||||
### include-after
|
||||
**Type:** String (multiline)
|
||||
**Usage:** Content after document body
|
||||
**Example:**
|
||||
```yaml
|
||||
include-after: |
|
||||
\appendix
|
||||
# Appendix content
|
||||
```
|
||||
|
||||
## Typography
|
||||
|
||||
### mainfont
|
||||
**Type:** String
|
||||
**Usage:** Main document font (requires XeLaTeX or LuaLaTeX)
|
||||
**Example:**
|
||||
```yaml
|
||||
mainfont: "Times New Roman"
|
||||
```
|
||||
|
||||
### sansfont
|
||||
**Type:** String
|
||||
**Usage:** Sans-serif font
|
||||
**Example:**
|
||||
```yaml
|
||||
sansfont: "Arial"
|
||||
```
|
||||
|
||||
### monofont
|
||||
**Type:** String
|
||||
**Usage:** Monospace font for code
|
||||
**Example:**
|
||||
```yaml
|
||||
monofont: "Courier New"
|
||||
```
|
||||
|
||||
### fontfamily
|
||||
**Type:** String
|
||||
**Usage:** LaTeX font package
|
||||
**Example:**
|
||||
```yaml
|
||||
fontfamily: palatino
|
||||
```
|
||||
|
||||
## Presentation (Beamer)
|
||||
|
||||
### theme
|
||||
**Type:** String
|
||||
**Usage:** Beamer theme
|
||||
**Options:** Madrid, Berlin, Copenhagen, Dresden, Frankfurt, Singapore, Warsaw
|
||||
**Example:**
|
||||
```yaml
|
||||
theme: Madrid
|
||||
```
|
||||
|
||||
### colortheme
|
||||
**Type:** String
|
||||
**Usage:** Beamer color scheme
|
||||
**Options:** default, dolphin, beaver, crane, seahorse
|
||||
**Example:**
|
||||
```yaml
|
||||
colortheme: default
|
||||
```
|
||||
|
||||
### fonttheme
|
||||
**Type:** String
|
||||
**Usage:** Beamer font theme
|
||||
**Options:** default, serif, structurebold, structureitalicserif
|
||||
**Example:**
|
||||
```yaml
|
||||
fonttheme: default
|
||||
```
|
||||
|
||||
### aspectratio
|
||||
**Type:** Integer
|
||||
**Usage:** Slide aspect ratio
|
||||
**Options:** `43` (4:3), `169` (16:9), `1610` (16:10)
|
||||
**Example:**
|
||||
```yaml
|
||||
aspectratio: 169
|
||||
```
|
||||
|
||||
### navigation
|
||||
**Type:** String
|
||||
**Usage:** Navigation symbols
|
||||
**Options:** horizontal, vertical, frame
|
||||
**Example:**
|
||||
```yaml
|
||||
navigation: horizontal
|
||||
```
|
||||
|
||||
## HTML Output
|
||||
|
||||
### css
|
||||
**Type:** String or List
|
||||
**Usage:** CSS stylesheet path(s)
|
||||
**Examples:**
|
||||
```yaml
|
||||
css: style.css
|
||||
|
||||
# Multiple stylesheets
|
||||
css:
|
||||
- style.css
|
||||
- syntax.css
|
||||
```
|
||||
|
||||
### self-contained
|
||||
**Type:** Boolean (command-line)
|
||||
**Usage:** Embed all resources in HTML
|
||||
**Command:**
|
||||
```bash
|
||||
pandoc doc.md -o doc.html --self-contained
|
||||
```
|
||||
|
||||
## Code Highlighting
|
||||
|
||||
### highlight-style
|
||||
**Type:** String
|
||||
**Usage:** Syntax highlighting theme
|
||||
**Options:** tango, pygments, kate, monochrome, espresso, zenburn, haddock, breezedark
|
||||
**Example:**
|
||||
```yaml
|
||||
highlight-style: tango
|
||||
```
|
||||
|
||||
## Custom Variables
|
||||
|
||||
### Custom Title Page Fields
|
||||
|
||||
**For thesis/academic work:**
|
||||
```yaml
|
||||
supervisor: "Dr. Jane Smith"
|
||||
institution: "University Name"
|
||||
department: "Department of Computer Science"
|
||||
degree: "BSc Computer Science"
|
||||
```
|
||||
|
||||
**Student Information:**
|
||||
```yaml
|
||||
student-id: "C21348423"
|
||||
programme: "TU856"
|
||||
module: "COMP4060"
|
||||
```
|
||||
|
||||
**Contact Information:**
|
||||
```yaml
|
||||
email: "student@example.com"
|
||||
website: "https://example.com"
|
||||
```
|
||||
|
||||
## BibTeX Reference
|
||||
|
||||
### Entry Types
|
||||
|
||||
**Article:**
|
||||
```bibtex
|
||||
@article{citekey,
|
||||
author = {Smith, John and Doe, Jane},
|
||||
title = {Paper Title},
|
||||
journal = {Journal Name},
|
||||
year = {2024},
|
||||
volume = {42},
|
||||
number = {3},
|
||||
pages = {123--145},
|
||||
doi = {10.1234/example}
|
||||
}
|
||||
```
|
||||
|
||||
**Book:**
|
||||
```bibtex
|
||||
@book{citekey,
|
||||
author = {Johnson, Alice},
|
||||
title = {Book Title},
|
||||
publisher = {Publisher Name},
|
||||
year = {2023},
|
||||
edition = {2nd},
|
||||
address = {City},
|
||||
isbn = {978-0-12-345678-9}
|
||||
}
|
||||
```
|
||||
|
||||
**Conference Paper:**
|
||||
```bibtex
|
||||
@inproceedings{citekey,
|
||||
author = {Brown, Robert},
|
||||
title = {Paper Title},
|
||||
booktitle = {Conference Proceedings},
|
||||
year = {2024},
|
||||
pages = {45--52},
|
||||
publisher = {ACM},
|
||||
doi = {10.1145/example}
|
||||
}
|
||||
```
|
||||
|
||||
**PhD Thesis:**
|
||||
```bibtex
|
||||
@phdthesis{citekey,
|
||||
author = {Williams, Michael},
|
||||
title = {Thesis Title},
|
||||
school = {University Name},
|
||||
year = {2023},
|
||||
address = {City, Country}
|
||||
}
|
||||
```
|
||||
|
||||
**Master's Thesis:**
|
||||
```bibtex
|
||||
@mastersthesis{citekey,
|
||||
author = {Davis, Sarah},
|
||||
title = {Thesis Title},
|
||||
school = {University Name},
|
||||
year = {2024}
|
||||
}
|
||||
```
|
||||
|
||||
**Website:**
|
||||
```bibtex
|
||||
@misc{citekey,
|
||||
author = {Organization},
|
||||
title = {Page Title},
|
||||
year = {2024},
|
||||
url = {https://example.com},
|
||||
note = {Accessed: 2024-11-16}
|
||||
}
|
||||
```
|
||||
|
||||
### BibTeX Field Reference
|
||||
|
||||
**Required vs Optional varies by entry type**
|
||||
|
||||
**Common Fields:**
|
||||
- `author` - Author names (use "and" to separate)
|
||||
- `title` - Work title
|
||||
- `year` - Publication year
|
||||
- `journal` - Journal name (article)
|
||||
- `booktitle` - Book/conference name
|
||||
- `publisher` - Publisher name
|
||||
- `school` - University (thesis)
|
||||
- `pages` - Page range (use double dash: 123--145)
|
||||
- `volume` - Volume number
|
||||
- `number` - Issue number
|
||||
- `edition` - Edition (2nd, 3rd, etc.)
|
||||
- `address` - Location (city, country)
|
||||
- `doi` - Digital Object Identifier
|
||||
- `url` - Web address
|
||||
- `note` - Additional information
|
||||
|
||||
**Author Formatting:**
|
||||
```bibtex
|
||||
author = {Lastname, Firstname}
|
||||
author = {Lastname1, Firstname1 and Lastname2, Firstname2}
|
||||
author = {Firstname Lastname} # Auto-parsed
|
||||
```
|
||||
|
||||
**Special Characters:**
|
||||
```bibtex
|
||||
title = {Study of {DNA} Sequencing} # Protect caps
|
||||
title = {Analysis of {IoT} Systems}
|
||||
author = {M{\"u}ller, Hans} # Umlaut
|
||||
```
|
||||
|
||||
## Example Complete Frontmatter
|
||||
|
||||
### Academic Paper
|
||||
```yaml
|
||||
---
|
||||
title: "Research Paper Title"
|
||||
author: "Author Name"
|
||||
date: "November 2024"
|
||||
lang: en-GB
|
||||
|
||||
bibliography: references.bib
|
||||
csl: harvard.csl
|
||||
link-citations: true
|
||||
|
||||
documentclass: report
|
||||
fontsize: 12pt
|
||||
geometry: margin=1in
|
||||
linestretch: 1.5
|
||||
numbersections: true
|
||||
|
||||
toc: true
|
||||
toc-depth: 3
|
||||
|
||||
header-includes: |
|
||||
\usepackage{graphicx}
|
||||
\usepackage{float}
|
||||
\usepackage{hyperref}
|
||||
---
|
||||
```
|
||||
|
||||
### Thesis
|
||||
```yaml
|
||||
---
|
||||
title: "Thesis Title"
|
||||
author: "Student Name"
|
||||
date: "Month Year"
|
||||
supervisor: "Dr. Supervisor Name"
|
||||
institution: "University Name"
|
||||
department: "Department Name"
|
||||
degree: "BSc Computer Science"
|
||||
lang: en-GB
|
||||
|
||||
bibliography: references.bib
|
||||
csl: harvard.csl
|
||||
link-citations: true
|
||||
|
||||
documentclass: report
|
||||
fontsize: 12pt
|
||||
geometry: margin=1in
|
||||
linestretch: 1.5
|
||||
numbersections: true
|
||||
secnumdepth: 3
|
||||
|
||||
toc: true
|
||||
toc-depth: 3
|
||||
lof: true
|
||||
lot: true
|
||||
---
|
||||
```
|
||||
|
||||
### Simple Article
|
||||
```yaml
|
||||
---
|
||||
title: "Article Title"
|
||||
author: "Author Name"
|
||||
date: "Date"
|
||||
lang: en-GB
|
||||
documentclass: article
|
||||
fontsize: 11pt
|
||||
geometry: margin=1in
|
||||
---
|
||||
```
|
||||
|
||||
## Variable Precedence
|
||||
|
||||
1. **Command-line variables** (`-V key=value`) override
|
||||
2. **Frontmatter variables**
|
||||
3. **Defaults file variables**
|
||||
4. **Pandoc built-in defaults**
|
||||
|
||||
## Resources
|
||||
|
||||
- **Pandoc Manual:** https://pandoc.org/MANUAL.html
|
||||
- **CSL Styles:** https://github.com/citation-style-language/styles
|
||||
- **BibTeX Reference:** https://www.bibtex.com/
|
||||
- **LaTeX Packages:** https://ctan.org/
|
||||
Reference in New Issue
Block a user