# Pdflatex

> |

- **Type:** Skill
- **Install:** `agentstack add skill-b1rd33-pdflatex-skill-pdflatex-skill`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [b1rd33](https://agentstack.voostack.com/s/b1rd33)
- **Installs:** 0
- **Category:** [Content & Media](https://agentstack.voostack.com/c/content-and-media)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [b1rd33](https://github.com/b1rd33)
- **Source:** https://github.com/b1rd33/pdflatex-skill

## Install

```sh
agentstack add skill-b1rd33-pdflatex-skill-pdflatex-skill
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# PDFLaTeX Compilation Skill

## Quick Start

```bash
# Basic compilation
pdflatex -interaction=nonstopmode document.tex

# With bibliography (biblatex + biber)
pdflatex document.tex && biber document && pdflatex document.tex && pdflatex document.tex

# Automated (recommended)
latexmk -pdf document.tex
```

## Reference Documentation

| Topic | File | Use When |
|-------|------|----------|
| Package reference | [packages.md](references/packages.md) | Need specific package syntax |
| Smart cross-refs | [cross-references.md](references/cross-references.md) | Using cleveref, labeling |
| Publication tables | [tables-siunitx.md](references/tables-siunitx.md) | Professional tables with aligned numbers |
| Build automation | [latexmk-config.md](references/latexmk-config.md) | Configuring latexmk |
| Journal submission | [journal-submission.md](references/journal-submission.md) | ACM, IEEE, Springer, Elsevier requirements |
| Version control | [version-control.md](references/version-control.md) | Git, latexdiff for revisions |
| PDF/A archival | [pdfa-archival.md](references/pdfa-archival.md) | Thesis submission, long-term preservation |
| Troubleshooting | [troubleshooting.md](references/troubleshooting.md) | Fixing compilation errors |
| Font guide | [fonts.md](references/fonts.md) | Custom fonts, XeLaTeX/LuaLaTeX font setup |

## Compilation Workflows

### Automated (Recommended)

```bash
latexmk -pdf document.tex           # pdflatex + auto-detect bibliography
latexmk -xelatex document.tex       # XeLaTeX for custom fonts
latexmk -lualatex document.tex      # LuaLaTeX for advanced scripting
latexmk -pdf -pvc document.tex      # Watch mode (recompile on save)
latexmk -c document.tex             # Clean auxiliary files
```

### Manual Chains

```bash
# BibTeX (traditional)
pdflatex doc.tex && bibtex doc && pdflatex doc.tex && pdflatex doc.tex

# Biber (biblatex - modern)
pdflatex doc.tex && biber doc && pdflatex doc.tex && pdflatex doc.tex

# Shell escape (minted, tikz externalize)
# WARNING: -shell-escape allows .tex files to run arbitrary system commands.
# Only use with trusted files. Prefer -shell-restricted when possible.
pdflatex -shell-escape document.tex

# IMPORTANT: Never hallucinate BibTeX entries. Always use the user's .bib file
# or ask for DOIs. Never fabricate citation data from memory.

```

### PDF Preview After Compilation

```bash
# macOS
open output.pdf

# Linux (uses xdg-open)
xdg-open output.pdf

# Or use the preview script
./scripts/preview_pdf.sh output.pdf
```

## Essential Package Loading Order

```latex
\documentclass[11pt,a4paper]{article}

% Encoding
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

% Math
\usepackage{amsmath,amssymb,amsthm}
\usepackage{mathtools}

% Graphics and layout
\usepackage{graphicx}
\usepackage[margin=1in]{geometry}
\usepackage{booktabs,siunitx}
\usepackage{microtype}

% Bibliography
\usepackage[backend=biber,style=numeric]{biblatex}
\addbibresource{references.bib}

% Cross-references (LOAD ORDER MATTERS)
\usepackage{hyperref}
\hypersetup{colorlinks=true,linkcolor=blue,citecolor=blue,urlcolor=cyan}
\usepackage{cleveref}  % MUST be after hyperref
```

## Engine Selection Guide

| Engine | Use When | Key Feature |
|--------|----------|-------------|
| `pdflatex` | Default choice, most compatible | Widest package support |
| `xelatex` | Custom/system fonts, Unicode-heavy docs | `fontspec` package |
| `lualatex` | Advanced scripting, complex typography | Lua scripting in TeX |
| `latexmk` | Always — wraps any engine | Auto-detects passes needed |

## Project Structure

```
paper/
├── main.tex              # Main document
├── references.bib        # Bibliography
├── .latexmkrc            # Build config
├── sections/
│   ├── abstract.tex
│   ├── introduction.tex
│   ├── methods.tex
│   ├── results.tex
│   └── conclusion.tex
├── figures/
│   └── *.pdf, *.png
└── output/               # Compiled PDFs
```

## Common Tasks

### Smart References (cleveref)

```latex
\label{fig:results}              % After \caption
\cref{fig:results}               % → "Figure 1"
\Cref{fig:results}               % → "Figure 1" (sentence start)
\cref{fig:a,fig:b,fig:c}         % → "Figures 1 to 3"
```

### Publication-Quality Tables

```latex
\begin{table}[htbp]
    \caption{Results comparison.}
    \label{tbl:results}
    \centering
    \begin{tabular}{l S[table-format=2.2] S[table-format=1.2]}
        \toprule
        Model & {Accuracy (\%)} & {F1} \\
        \midrule
        Baseline & 85.32 & 0.83 \\
        \textbf{Ours} & \bfseries 92.15 & \bfseries 0.91 \\
        \bottomrule
    \end{tabular}
\end{table}
```

### Generate Revision Diff

```bash
# Compare current with submitted version
latexdiff-vc --git -r v1.0-submission main.tex
pdflatex main-diffv1.0-submission.tex
```

## Quick Fixes

| Problem | Solution |
|---------|----------|
| `??` in PDF | Run pdflatex twice |
| Citations missing | Run biber/bibtex + pdflatex x2 |
| Undefined control | Add missing `\usepackage{}` |
| Overfull hbox | Add `\sloppy` or adjust text |
| Package conflict | Check load order (hyperref before cleveref) |
| Font not found (XeLaTeX) | Check font name with `fc-list`, use `fontspec` |
| Missing .sty file | `sudo tlmgr install packagename` |

## Example Templates

Ready-to-use templates in `examples/`:
- `research-paper.tex` — Academic paper with biblatex, cleveref, siunitx (+ `references.bib`)
- `invoice.tex` — Professional invoice with line items and totals
- `report.tex` — Business report with TOC, sections, figures, tables
- `demo-report.tex` — Rich report with charts, tables, and scatter plots (pgfplots)
- `letter.tex` — Formal business letter
- `cv.tex` — Modern CV/resume
- `.latexmkrc` — Ready-to-use build configuration

## Scripts

```bash
./scripts/compile_latex.sh document.tex [pdflatex|xelatex|lualatex] [--bib bibtex|biber] [--clean] [--shell-escape] [--output-dir DIR]
./scripts/clean_latex.sh [directory] [--all]
./scripts/preview_pdf.sh output.pdf
```

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [b1rd33](https://github.com/b1rd33)
- **Source:** [b1rd33/pdflatex-skill](https://github.com/b1rd33/pdflatex-skill)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-b1rd33-pdflatex-skill-pdflatex-skill
- Seller: https://agentstack.voostack.com/s/b1rd33
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
