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
- Current directory: !
pwd
- Available .md files: !
find . -maxdepth 2 -name '*.md' -not -name 'CHANGELOG.md' -not -name 'README.md'
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.
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:
- 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
- Install LaTeX toolchain if not available:
apt-get update && apt-get install -y texlive-latex-extra texlive-fonts-recommended \
texlive-fonts-extra texlive-science latexmk
- Compile with two passes for cross-references:
pdflatex -interaction=nonstopmode DOCUMENT.tex
pdflatex -interaction=nonstopmode DOCUMENT.tex
- If compilation fails, check 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
- Report the output PDF path, page count, and file size
- Summarize what visualizations were generated
- List any compilation warnings that may need attention
- 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.
1---
2name: docs-latex
3description: Convert Markdown to LaTeX with TikZ and compile to PDF. Use when wanting a presentation-quality PDF, a professional report with diagrams, or print-ready documentation.
4args: <file> [--no-compile] [--visualizations] [--report-type=roadmap|lifecycle|general]
5allowed-tools: Bash, Read, Write, Edit, Grep, Glob, TodoWrite
6argument-hint: path/to/document.md
7disable-model-invocation: true
8created: 2026-02-08
9modified: 2026-06-18
10reviewed: 2026-02-08
11---
12
13# Markdown to LaTeX Conversion
14
15Convert Markdown documents to professional LaTeX with advanced typesetting, TikZ/PGFPlots visualizations, and PDF compilation.
16
17## When to Use This Skill
18
19| Use this skill when... | Use another skill when... |
20|------------------------|--------------------------|
21| Converting Markdown to presentation-quality PDF | Writing Markdown documentation (`/docs:generate`) |
22| Creating reports with diagrams and visualizations | Simple text formatting |
23| Generating print-ready strategic documents | Creating HTML documentation |
24| Building lifecycle reports with charts and timelines | Syncing existing docs (`/docs:sync`) |
25
26## Context
27
28- Current directory: !`pwd`
29- Available .md files: !`find . -maxdepth 2 -name '*.md' -not -name 'CHANGELOG.md' -not -name 'README.md'`
30
31## Parameters
32
33- `<file>`: Path to the Markdown source file (required)
34- `--no-compile`: Generate `.tex` file only, skip PDF compilation
35- `--visualizations`: Include TikZ/PGFPlots diagrams (timelines, charts, risk matrices)
36- `--report-type`: Document structure preset
37 - `roadmap`: Phase-based roadmap with timeline visualization
38 - `lifecycle`: Project lifecycle with release charts and velocity graphs
39 - `general`: Standard professional document (default)
40
41## Execution
42
43Execute this Markdown-to-LaTeX conversion workflow:
44
45### Step 1: Analyze the Markdown source
46
47Read the source Markdown file and extract:
48- Document title and metadata
49- Section hierarchy (map `#` levels to LaTeX chapters/sections)
50- Tables, lists, code blocks, callout blocks, and blockquotes
51- Priorities or status indicators for color-coded markers
52- Numerical data suitable for visualization
53
54### Step 2: Generate the LaTeX document
55
56Create a `.tex` file adjacent to the source. Use the document preamble, color definitions, custom environments, and conversion rules from [REFERENCE.md](REFERENCE.md).
57
58Apply the Markdown-to-LaTeX conversion rules:
59
60| Markdown | LaTeX |
61|----------|-------|
62| `# Title` | `\chapter{Title}` |
63| `## Section` | `\section{Section}` |
64| `### Subsection` | `\subsection{Subsection}` |
65| `**bold**` | `\textbf{bold}` |
66| `*italic*` | `\textit{italic}` |
67| `` `code` `` | `\texttt{code}` |
68| `- item` | `\begin{itemize}\item ...\end{itemize}` |
69| `1. item` | `\begin{enumerate}\item ...\end{enumerate}` |
70| `> quote` | `\begin{tcolorbox}...\end{tcolorbox}` |
71| `[text](url)` | `\href{url}{text}` |
72| Tables | `booktabs` tables with `\toprule`, `\midrule`, `\bottomrule` |
73| Code blocks | `\begin{lstlisting}...\end{lstlisting}` |
74| `- [ ]` / `- [x]` | `$\square$` / `$\boxtimes$` (requires `amssymb`) |
75
76### Step 3: Add visualizations (when --visualizations or data suggests it)
77
78Choose appropriate TikZ/PGFPlots visualizations based on document content. Use the visualization templates from [REFERENCE.md](REFERENCE.md):
79- **Timeline** for roadmaps with phases
80- **Bar/pie charts** for release or metric data
81- **Risk matrix** for documents with risk/impact data
82- **Test pyramid** for QA/testing documents
83
84### Step 4: Compile to PDF
85
861. Install LaTeX toolchain if not available:
87 ```bash
88 apt-get update && apt-get install -y texlive-latex-extra texlive-fonts-recommended \
89 texlive-fonts-extra texlive-science latexmk
90 ```
912. Compile with two passes for cross-references:
92 ```bash
93 pdflatex -interaction=nonstopmode DOCUMENT.tex
94 pdflatex -interaction=nonstopmode DOCUMENT.tex
95 ```
963. If compilation fails, check [REFERENCE.md](REFERENCE.md) for common compilation fixes.
97
98### Step 5: Clean up repository artifacts
99
100Add 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`.
101
102## Post-actions
103
1041. Report the output PDF path, page count, and file size
1052. Summarize what visualizations were generated
1063. List any compilation warnings that may need attention
1074. Suggest the `.gitignore` additions if not already present
108
109## Agentic Optimizations
110
111| Context | Command |
112|---------|---------|
113| Check LaTeX installed | `which pdflatex 2>/dev/null` |
114| Quick compile | `pdflatex -interaction=nonstopmode -halt-on-error FILE.tex` |
115| Full compile (with TOC) | `pdflatex -interaction=nonstopmode FILE.tex && pdflatex -interaction=nonstopmode FILE.tex` |
116| Check PDF page count | `pdfinfo FILE.pdf 2>/dev/null` |
117| Check PDF file size | `stat -f %z FILE.pdf 2>/dev/null` |
118| Install toolchain | `apt-get install -y texlive-latex-extra texlive-fonts-recommended texlive-fonts-extra texlive-science` |
119| Errors only | `pdflatex -interaction=nonstopmode FILE.tex 2>&1` |
120
121For detailed LaTeX patterns, TikZ templates, and package reference, see [REFERENCE.md](REFERENCE.md).