home / skills / laurigates / claude-plugins / docs-latex

This skill converts Markdown to professional LaTeX with TikZ visualizations and compiles a ready-to-distribute PDF.

npx playbooks add skill laurigates/claude-plugins --skill docs-latex

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
5.3 KB
---
model: opus
name: docs-latex
description: |
  Convert Markdown documents to professional LaTeX with TikZ visualizations and compile to PDF.
  Use when the user wants to create a presentation-quality PDF from a Markdown document, generate
  a professional report with diagrams, or convert documentation to print-ready format.
args: <file> [--no-compile] [--visualizations] [--report-type=roadmap|lifecycle|general]
allowed-tools: Bash, Read, Write, Edit, Grep, Glob, TodoWrite
argument-hint: path/to/document.md
created: 2026-02-08
modified: 2026-02-10
reviewed: 2026-02-08
---

# Markdown to LaTeX Conversion

Convert Markdown documents to professional LaTeX with advanced typesetting, TikZ/PGFPlots visualizations, and PDF compilation.

## When to Use This Skill

| Use this skill when... | Use another skill when... |
|------------------------|--------------------------|
| Converting Markdown to presentation-quality PDF | Writing Markdown documentation (`/docs:generate`) |
| Creating reports with diagrams and visualizations | Simple text formatting |
| Generating print-ready strategic documents | Creating HTML documentation |
| Building lifecycle reports with charts and timelines | Syncing existing docs (`/docs:sync`) |

## Context

- Source file exists: !`test -f "$1" && echo "yes" || echo "no"`
- LaTeX installed: !`which pdflatex 2>/dev/null`
- Current directory: !`pwd`
- Available .md files: !`find . -maxdepth 2 -name '*.md' -not -name 'CHANGELOG.md' -not -name 'README.md' 2>/dev/null`

## Parameters

- `<file>`: Path to the Markdown source file (required)
- `--no-compile`: Generate `.tex` file only, skip PDF compilation
- `--visualizations`: Include TikZ/PGFPlots diagrams (timelines, charts, risk matrices)
- `--report-type`: Document structure preset
  - `roadmap`: Phase-based roadmap with timeline visualization
  - `lifecycle`: Project lifecycle with release charts and velocity graphs
  - `general`: Standard professional document (default)

## Execution

Execute this Markdown-to-LaTeX conversion workflow:

### Step 1: Analyze the Markdown source

Read the source Markdown file and extract:
- Document title and metadata
- Section hierarchy (map `#` levels to LaTeX chapters/sections)
- Tables, lists, code blocks, callout blocks, and blockquotes
- Priorities or status indicators for color-coded markers
- Numerical data suitable for visualization

### Step 2: Generate the LaTeX document

Create a `.tex` file adjacent to the source. Use the document preamble, color definitions, custom environments, and conversion rules from [REFERENCE.md](REFERENCE.md).

Apply the Markdown-to-LaTeX conversion rules:

| Markdown | LaTeX |
|----------|-------|
| `# Title` | `\chapter{Title}` |
| `## Section` | `\section{Section}` |
| `### Subsection` | `\subsection{Subsection}` |
| `**bold**` | `\textbf{bold}` |
| `*italic*` | `\textit{italic}` |
| `` `code` `` | `\texttt{code}` |
| `- item` | `\begin{itemize}\item ...\end{itemize}` |
| `1. item` | `\begin{enumerate}\item ...\end{enumerate}` |
| `> quote` | `\begin{tcolorbox}...\end{tcolorbox}` |
| `[text](url)` | `\href{url}{text}` |
| Tables | `booktabs` tables with `\toprule`, `\midrule`, `\bottomrule` |
| Code blocks | `\begin{lstlisting}...\end{lstlisting}` |
| `- [ ]` / `- [x]` | `$\square$` / `$\boxtimes$` (requires `amssymb`) |

### Step 3: Add visualizations (when --visualizations or data suggests it)

Choose appropriate TikZ/PGFPlots visualizations based on document content. Use the visualization templates from [REFERENCE.md](REFERENCE.md):
- **Timeline** for roadmaps with phases
- **Bar/pie charts** for release or metric data
- **Risk matrix** for documents with risk/impact data
- **Test pyramid** for QA/testing documents

### Step 4: Compile to PDF

1. Install LaTeX toolchain if not available:
   ```bash
   apt-get update && apt-get install -y texlive-latex-extra texlive-fonts-recommended \
     texlive-fonts-extra texlive-science latexmk
   ```
2. Compile with two passes for cross-references:
   ```bash
   pdflatex -interaction=nonstopmode DOCUMENT.tex
   pdflatex -interaction=nonstopmode DOCUMENT.tex
   ```
3. If compilation fails, check [REFERENCE.md](REFERENCE.md) for common compilation fixes.

### Step 5: Clean up repository artifacts

Add LaTeX build artifacts to `.gitignore` if not already present: `*.aux`, `*.log`, `*.out`, `*.toc`, `*.lof`, `*.lot`, `*.fls`, `*.fdb_latexmk`, `*.synctex.gz`, `*.bbl`, `*.blg`, `*.nav`, `*.snm`, `*.vrb`.

## Post-actions

1. Report the output PDF path, page count, and file size
2. Summarize what visualizations were generated
3. List any compilation warnings that may need attention
4. Suggest the `.gitignore` additions if not already present

## Agentic Optimizations

| Context | Command |
|---------|---------|
| Check LaTeX installed | `which pdflatex 2>/dev/null` |
| Quick compile | `pdflatex -interaction=nonstopmode -halt-on-error FILE.tex` |
| Full compile (with TOC) | `pdflatex -interaction=nonstopmode FILE.tex && pdflatex -interaction=nonstopmode FILE.tex` |
| Check PDF page count | `pdfinfo FILE.pdf 2>/dev/null` |
| Check PDF file size | `stat -f %z FILE.pdf 2>/dev/null` |
| Install toolchain | `apt-get install -y texlive-latex-extra texlive-fonts-recommended texlive-fonts-extra texlive-science` |
| Errors only | `pdflatex -interaction=nonstopmode FILE.tex 2>&1` |

For detailed LaTeX patterns, TikZ templates, and package reference, see [REFERENCE.md](REFERENCE.md).

Overview

This skill converts Markdown documents into professional LaTeX source and optionally compiles them to presentation-quality PDFs with TikZ/PGFPlots visualizations. It maps Markdown structure, tables, code blocks, and callouts to LaTeX environments and can auto-generate timelines, charts, and risk matrices. Use it to produce print-ready reports, roadmaps, and technical documents from existing Markdown sources.

How this skill works

The tool reads the Markdown file, extracts title, metadata, section hierarchy, tables, lists, code blocks, and any numerical data suitable for charts. It generates a .tex file next to the source using a configurable preamble, color definitions, and conversion rules (headers -> chapters/sections, lists -> itemize/enumerate, code -> listings, etc.). When requested, it adds TikZ/PGFPlots visualizations based on detected data or the --visualizations flag, then runs a multi-pass pdflatex compile unless --no-compile is set.

When to use it

  • Converting a Markdown document into a print-ready PDF for distribution or review.
  • Creating structured reports or roadmaps that need timelines, charts, or risk matrices.
  • Preparing a professional document with consistent typesetting, tables, and code formatting.
  • Generating a LaTeX source file for manual editing or further LaTeX customization.
  • When you need a PDF with cross-references, table of contents, and clean booktabs tables.

Best practices

  • Include clear title and metadata in the Markdown to improve LaTeX front matter generation.
  • Mark numerical sections or CSV-style tables clearly so visualization templates can detect data.
  • Use consistent heading levels (#, ##, ###) to map cleanly to chapters/sections/subsections.
  • Run the tool in a clean working directory and add LaTeX build artifacts to .gitignore afterward.
  • If compilation fails, run pdflatex twice and inspect the log for missing packages or unresolved references.

Example use cases

  • Convert a product roadmap Markdown into a roadmap PDF with a TikZ timeline and phase markers.
  • Turn project lifecycle notes and release metrics into a formal report with bar charts and velocity plots.
  • Generate a printable technical report that includes code blocks formatted with listings and booktabs tables.
  • Produce a risk assessment document that includes a generated risk matrix visualization.
  • Export documentation chapters to LaTeX for final typesetting and archival as a PDF.

FAQ

Can I skip PDF generation and only get the .tex file?

Yes. Use the --no-compile flag to generate the .tex file only without running pdflatex.

How do visualizations get selected?

Visualizations are added when you pass --visualizations or when the tool detects structured numerical or timeline data; templates choose timeline, bar/pie charts, risk matrices, or test pyramids accordingly.