Markdown 转 LaTeX PDF
docs-latex
将 Markdown 转换为带 TikZ 的 LaTeX 并编译为 PDF。当需要演示文稿质量的 PDF、带图表的专业报告或可直接打印的文档时使用。
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 60
- Forks
- 6
01 前言 Front Matter
- args
- <file> [--no-compile] [--visualizations] [--report-type=roadmap|lifecycle|general]
- name
- docs-latex
- created
- 1770508800000
- modified
- 1781740800000
- reviewed
- 1770508800000
- description
- 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.
- allowed-tools
- Bash, Read, Write, Edit, Grep, Glob, TodoWrite
- argument-hint
- path/to/document.md
- disable-model-invocation
- true
02 资源文件 1
- 参考文档REFERENCE.md13.3 KB
03 SKILL.md 正文
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.texfile only, skip PDF compilation--visualizations: Include TikZ/PGFPlots diagrams (timelines, charts, risk matrices)--report-type: Document structure presetroadmap: Phase-based roadmap with timeline visualizationlifecycle: Project lifecycle with release charts and velocity graphsgeneral: 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
.gitignoreadditions 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.
04 同仓库更多 Skills
session-workflow-capture
Workflow-tool scripts and workflow friction from this session, filed as issues here or in the plugins repo. Use when a session ran Workflow scripts.
kitty-show-image
Show the user an image with a note on what to judge, via a file send or a labelled kitty tab. Use when the user must see an image, or icat fails with no /dev/tty.
kitty-session-persistence
Snapshot and restore kitty terminal sessions on macOS. Use when surviving WindowServer hangs without losing tabs, configuring snapshots, or restoring after a force-reboot.
kitty-remote-control
Safe kitty remote control from an agent — read panes with kitty @ ls/get-text, notify, and never mutate the live terminal unasked. Use when running inside kitty.
docs-reference-check
Dangling doc-reference gate: flag markdown naming repo paths or relative links that no longer exist. Use when docs cite moved/deleted files, or wiring a doc-drift lint.
YouTube 视频上传与编辑
youtube-upload
通过 Data API v3 将视频上传到 YouTube,并在之后编辑其标题、描述、标签或缩略图。适用于发布 YouTube 视频或修改其标题。