Make dense one-glance study cheatsheets as LaTeX -> PDF (A4 landscape, 4 columns, color-coded checkbox items, framed code boxes), in English and/or Chinese. Use when the user asks for a cheatsheet, cheat sheet, quick reference, study sheet or 速查表 on a language, tool, library, course, book, tutorial, lecture, or research paper.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Latex Cheatsheet?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/yyyujintang-latex-cheatsheet)
---
name: latex-cheatsheet
description: Make dense one-glance study cheatsheets as LaTeX -> PDF (A4 landscape, 4 columns, color-coded checkbox items, framed code boxes), in English and/or Chinese. Use when the user asks for a cheatsheet, cheat sheet, quick reference, study sheet or 速查表 on a language, tool, library, course, book, tutorial, lecture, or research paper.
---
# LaTeX cheatsheet
A cheatsheet lets a reader learn a new subject fast. Every sheet is A4 landscape, 4 columns with a column
rule, small text, short color-coded checkbox items and framed code boxes. There are two designs:
- **Topic sheet** (language, tool, library, course, book chapter): plain centered title, 2-3 pages,
`templates/cheatsheet-EN.tex` / `cheatsheet-CN.tex`.
- **Paper sheet** (one research paper): title banner, the paper's own color palette, numbered colored section
headings, `defbox` panels, full-width figure strips, 4 pages, always English + Chinese + README,
`templates/paper-cheatsheet-EN.tex` / `paper-cheatsheet-CN.tex`. **Never use the topic template for a paper.**
Bundled files (paths relative to this skill folder):
- `templates/cheatsheet-EN.tex`: topic sheet, English (pdflatex). A complete, compiling example.
- `templates/cheatsheet-CN.tex`: topic sheet, Chinese (xelatex + ctex).
- `templates/paper-cheatsheet-EN.tex` / `paper-cheatsheet-CN.tex`: paper sheet skeleton with every section, strip
and box in place, filled with `<placeholders>` and `example-image` figures.
- `scripts/palette.py`: lists the main colors of the paper's figures (for the paper palette).
- `scripts/check_sheet.py`: page count, overfull boxes, CJK in English sheets, long code lines, renders pages to PNG.
- `references/paper-sheets.md`: **the full spec for paper sheets** (files, palette, 4-page plan, the 11 sections,
writing rules, Chinese version, README). Read all of it before a paper sheet.
- `references/series.md`: extra rules for multi-sheet series (books, scanned PDFs, tutorials, lecture slides,
practice/interview series).
- `references/xhs-caption.md`: optional plain-text social-media caption (e.g. Xiaohongshu) for a finished sheet.
## Workflow
1. **Pick the type and language.** Topic sheet (default), paper sheet (read `references/paper-sheets.md`
in full), or series: a whole book, tutorial, course or slide deck (read `references/series.md`).
Language: English by default; Chinese (`-CN`) if the user
asks or writes in Chinese; papers always get both.
2. **Copy the matching template** next to where the sheet belongs, named `<topic>-cheatsheet.tex`
(Chinese: `<topic>-cheatsheet-CN.tex`). Keep the preamble and macros unchanged except what is listed under
"Allowed preamble changes". Replace the example body / placeholders.
3. **Write the content** (rules below). Check every code snippet: run it when possible.
4. **Build**: `latexmk -pdf <file>.tex` (Chinese: `latexmk -xelatex <file>-CN.tex`).
5. **Verify**: `python3 <skill>/scripts/check_sheet.py <file>.tex`, then open every rendered PNG with the
Read tool and look at it: no near-empty column, no text running into the next column, no overlapping
figures, page count in range. Fix and rebuild until clean.
6. **Clean up**: `latexmk -c <file>.tex` and delete the `_png/` folder. Keep the `.tex` and `.pdf`.
## Format (topic sheets; paper sheets follow `references/paper-sheets.md`)
- `article`, 10pt, A4 **landscape**, `\begin{multicols*}{4}`, `\footnotesize`, `\raggedcolumns\raggedright`.
- Length: usually 2 pages, 3 at most.
- **Title block**: centered `{\Large VIP Cheatsheet: <Topic>}`, a subtitle line, a **fixed date**
(e.g. `October 19, 2026`; Chinese `整理自2026年10月19日`), never `\today`, so rebuilding doesn't change it.
- **Header** (fancyhdr): left = course code or source name, center = course title or part/chapter,
right = `\texttt{\href{url}{short url}}` to the official docs or the source.
- **Footer**: left = `Template CopyRight by Jenny Tang` (keep this line as is), center = page number,
right = term or year (e.g. `\textsc{Fall 2026}`).
- **Allowed preamble changes**: header/footer text; `language=` in `\lstset` to match the code;
`amsmath` and `bm` for formulas; `graphicx`/`booktabs`/`tikz` when a sheet needs figures or tables.
## Macros (use these, don't invent new ones)
| Macro | Use |
|---|---|
| `\sect{Name}` | bold section heading |
| `\itm{c1}{Name} text` | checkbox item. All items in one section share a color; rotate c1 blue -> c2 red -> c3 green -> c4 purple from section to section |
| `\begin{cmd}\begin{lstlisting} ... \end{lstlisting}\end{cmd}` | black-framed code box, 6.6pt code, gray comments saying what each line does |
| `\remark{...}` | blue italic "Remark:" (Chinese "注:") for gotchas and tips |
| `\code{...}` | inline monospace |
Paper sheets have these too (already defined in the paper template):
| Macro | Use |
|---|---|
| `\sect[c1]{1. Name}` | numbered section heading in a color, with a color bar and a thin rule |
| `\begin{defbox}[color]{Title} ... \end{defbox}` | titled panel (problem, answer, headline numbers ...) |
| `\begin{takeaway}[color] ... \end{takeaway}` | left-ruled box for the final takeaway |
| `\hi{...}` | bold highlight in the paper's accent color |
## Content pattern
- Short items: one line of explanation + a small code box + an optional remark.
- Order, basics to advanced: **what and why** -> **setup / run** -> **core concepts** -> a **worked example**
that combines several items -> **Pitfalls** (bullet list) -> optionally **Short readings** (links).
- Use one running example through the whole sheet when possible (e.g. one small codebase or dataset).
- When the reader likely knows a related tool, compare with it (e.g. "Pitfalls for Python programmers").
- Concise and precise. Every code snippet must be correct; compile and run it when possible.
- A code box fits about 50 characters per line in one column; longer lines wrap badly. Split long lines
and keep comments short (`check_sheet.py` warns about long lines).
- Content that is not in the source (your own addition or opinion) is marked as such in a `\remark`.
## Chinese sheets (`-CN`)
Start from `templates/cheatsheet-CN.tex`, which already has these differences from the English one:
- `\usepackage[fontset=mac,linespread=1.1]{ctex}` and no `fontenc`. Use `fontset=fandol` (or `ubuntu`) on Linux,
`fontset=windows` on Windows. If the sheet spills onto an extra page, lower `linespread` to 1.05 or 1.0.
- `extendedchars=false` in `\lstset`; `\remark` prefix `注:`; build with `latexmk -xelatex`.
- Technical terms stay in English (policy, rollout, gradient, closure...); only the prose is Chinese.
- In code boxes, don't align columns across Chinese and English text (different character widths).
- Section names: 是什么、为什么 / 核心操作 / 完整例子 / 常见坑 / 延伸阅读; critique section is 阅读提示.
- A Chinese version of an English sheet is saved next to it with `-CN` before `.tex`.
## Public tone
Sheets are meant to be shared. Don't include private information about the user (their own unpublished
projects, plans, personal details). A critique section is called "Reading notes" (Chinese 阅读提示),
written as gentle, neutral facts that help a reader, not reviewer-style attacks.
## Checks before you finish
- English `.tex` has no Chinese characters (pdflatex fails or drops them).
- No overfull boxes; no near-empty column; page count in range.
- Item colors rotate by section; every section uses the macros above.
- Paper sheets: banner, problem/answer boxes, results strip, figure strip, 11 numbered sections, palette taken
from the paper's figures, every number cited to its table/figure, `(my note)` on every addition.
- Fixed date, header link works, footer reads `Template CopyRight by Jenny Tang`.
## Optional extras (only if asked)
A social-media caption for posting a sheet (`references/xhs-caption.md`), Beamer slides in the same color scheme, a lecture script (`lecture-script.md`), or a runnable `example/`
folder with a `README.md` holding the running example's code.