Imported from Aero123421/latex-writer-skill (
latexpro/SKILL.md). Install upstream withnpx skills add Aero123421/latex-writer-skill --skill latexpro. Copyright stays with the author.
LaTeX Pro
Produce the smallest reliable LaTeX solution that satisfies the request, compiles cleanly, stays easy to edit, and holds up when the final PDF is visually checked.
Core operating pattern
- Decide the output mode: snippet, single-file document, multi-file project, surgical edit, log debugging, or visual-QA run.
- Classify the request into a document family before choosing packages.
- Pick the lightest fitting template from references/template-catalog.md.
- Read only the references that matter for the current task.
- Return compile-ready source plus the exact commands needed to build it.
- For page-based deliverables, do not stop at “compile succeeded.” Run the visual-review loop.
- Prefer portability and maintainability over flashy package stacks.
Document-family classifier
Use references/arxiv-informed-design.md when the request sounds like any of these:
- techreport: corporate research note, technical report, research update, official lab write-up
- systemcard: model card, system card, intended use, limitations, risks, mitigations, safety summary
- benchmark: evaluation note, benchmark memo, ablation report, scoreboard update, performance comparison
- figurefirst: vision paper, multimodal paper, teaser figure, hero figure, image-led research note
- visualsurvey: comparison sheet, landscape overview, method family survey, quick literature snapshot
- labmemo: internal memo, checkpoint, rollout note, design review, handoff note
- datasheet: fact sheet, platform summary, component sheet, spec page
If one of these families fits, prefer it over a generic article or report template.
Visual-review loop
For anything that will be shipped as a PDF or judged by layout:
- Compile the
.texsource. - Render the PDF pages to images.
- Inspect for overlap, clipping, edge crowding, tiny text, bad spacing, or visually confusing density.
- Revise the LaTeX.
- Re-render and re-check before finalizing.
Use the bundled commands when relevant:
python scripts/latex_tool.py review main.tex --outdir build --review-dir review --strictpython scripts/latex_tool.py qa build/main.pdf --outdir review --strictpython scripts/latex_tool.py render-review build/main.pdf --outdir review
Read references/visual-qa.md when the document contains figures, diagrams, posters, Beamer slides, dense tables, multi-column layout, or tightly arranged callout boxes.
Use this skill for
- New
.texfiles, reusable snippets, or full document scaffolds - Edits to existing LaTeX while preserving labels, citekeys, macros, and class choices when possible
- Academic and technical writing: article, report, thesis, book, handout, rebuttal, poster, slides, whitepaper
- Corpus-informed corporate and enterprise layouts: tech report, system card, benchmark note, visual survey, lab memo, datasheet
- Rich expression: equations, theorem environments, algorithms, code listings, tables, TikZ diagrams, PGFPlots charts,
tcolorboxlayouts, multicolumn handouts - Practical business or teaching documents: one-page brief, CV, letter, exam, invoice, newsletter, grant outline
- Japanese or bilingual documents that should compile well with LuaLaTeX
- Build commands, dependency checks, installer guidance, first-error log debugging, and rendered-PDF review
Do not use this skill for
- Non-LaTeX formats unless the user explicitly requests LaTeX source
- Replacing an official publisher or venue template when the user already has one; adapt around the provided class instead
- Turning on
--shell-escapeunless the user explicitly wantsmintedor another feature that truly requires it - Returning a visually risky PDF without running a render-and-review pass when the task is layout-sensitive
Output contract
When generating new LaTeX
- If one file is enough, return one file.
- If the task will obviously grow, return a small file tree first, then complete file contents.
- Add short
【編集ポイント】comments only where the user is likely to customize the result. - Include compile commands when the user asked for a template, a project scaffold, or portability help.
- If the end result is meant to be a PDF, include the review command as well as the compile command.
When editing existing LaTeX
- Preserve the document class unless there is a concrete reason to change it.
- Preserve labels, bibliography flow, and user-defined macros whenever possible.
- Prefer localized rewrites or diffs over unnecessary whole-file replacements.
- Explain unusual package additions or removals in one sentence.
- If the edit changes layout, mention the review step explicitly.
When debugging
- Find the first fatal error in the log.
- Treat later errors as possible cascades until the first fatal error is fixed.
- Prefer the smallest change that restores compilation.
- Mention warnings only after the fatal path is addressed.
- If the document compiles but still looks wrong, switch to visual-QA mode instead of log-only mode.
Output modes
- Snippet mode — single table, figure, theorem block, TikZ picture, PGFPlots chart, bibliography fragment, or preamble patch.
- Single-file mode — small to medium documents that should be easy to paste into one
.texfile. - Multi-file project mode —
main.texplus sections, bibliography, and figures. - Surgical edit mode — preserve an existing project while fixing or extending it.
- Log-triage mode — compiler output, missing packages, or broken build commands.
- Visual-QA mode — PDFs, posters, slides, one-pagers, newsletters, box-heavy layouts, multi-column pages, dense charts, or anything with a history of overlap / clipping / awkward spacing.
Template chooser
Load the detailed notes from references/template-catalog.md only when needed.
| Need | Template |
|---|---|
| Minimal note / memo / reproducible example | assets/template-basic.tex |
| Paper / preprint / technical article | assets/template-article.tex |
| Student or engineering report | assets/template-report.tex |
| Thesis / dissertation / long-form study | assets/template-thesis.tex |
| Book / monograph / lecture notes | assets/template-book.tex |
| Whitepaper / technical narrative | assets/template-whitepaper.tex |
| Corporate technical report | assets/template-techreport.tex |
| System card / model card / safety summary | assets/template-systemcard.tex |
| Benchmark note / evaluation memo | assets/template-benchmark.tex |
| Figure-first paper / teaser-first note | assets/template-figurefirst.tex |
| Visual survey / landscape overview | assets/template-visualsurvey.tex |
| Internal memo / checkpoint note | assets/template-labmemo.tex |
| Datasheet / fact sheet / platform summary | assets/template-datasheet.tex |
| Beamer presentation | assets/template-slide.tex |
| One-page brief / executive summary | assets/template-onepager.tex |
| CV / résumé | assets/template-cv.tex |
| Formal letter / cover letter | assets/template-letter.tex |
| Assignment / problem set | assets/template-problemset.tex |
| Exam paper | assets/template-exam.tex |
| Handout / seminar notes | assets/template-handout.tex |
| Compact cheat sheet | assets/template-cheatsheet.tex |
| Poster / one-page overview | assets/template-poster.tex |
| Newsletter / lab update | assets/template-newsletter.tex |
| Grant concept note | assets/template-grant.tex |
| Invoice / quote / statement | assets/template-invoice.tex |
| Native TeX diagram | assets/template-diagram.tex |
| Native TeX chart / plot | assets/template-plot.tex |
For richer fragments instead of full documents, load:
assets/preamble-snippets.texassets/snippets-rich-layouts.texassets/snippets-data-and-visuals.texassets/snippets-style-presets.tex
Engine and package policy
- Default to LuaLaTeX.
- If Japanese is present or likely, use
luatexjaandluatexja-preset. - Keep packages intentional. Avoid stacking multiple packages for the same job without a reason.
- Keep
hyperreflate andcleverefafterhyperref. - Prefer standard packages available in TeX Live, MacTeX, and MiKTeX.
- Use
listingsby default for code. Usemintedonly when explicitly requested.
Authoring rules
Math and structure
- Use semantic sectioning commands, not manual font-size formatting.
- Use
align,split,cases, andmultline; never useeqnarray. - Put
\labelimmediately after\caption. - Use macros for repeated notation.
Tables and figures
- Use
booktabsfor professional tables. - Add
siunitxwhen numeric alignment matters. - Use
tabularxorlongtablewhen width or pagination matters. - Make figure and table labels predictable:
fig:*,tab:*,eq:*,sec:*,chap:*. - When a page is tight, move or resize the visual before shrinking text aggressively.
Layout and readability
- Prefer breathing room to cramming.
- If a diagram node label risks crossing into another panel, increase spacing or split the composition.
- If a chart and flow diagram compete on the same line, separate them before reducing font size.
- For posters, newsletters, one-pagers, visual surveys, and figure-first layouts, preserve clear gutters between columns and boxes.
- When content is dense, allow an extra page instead of forcing a brittle single-page result.
File and project hygiene
- Keep a document easy to grow and easy to diff.
- If a task obviously needs sections or assets, do not force everything into one giant file.
- If the user already has a project tree, fit into it instead of imposing a new one.
- Keep review artifacts out of the final deliverable unless the user asks for them.
Rich-expression reference map
Read only the files that matter.
- Tables, wide layouts, long tables: references/figures-tables.md
- Theorems, proofs, assignment structures: references/theorems-algorithms.md
- TikZ and PGFPlots: references/tikz-pgfplots.md
- CV, letter, poster, newsletter, invoice, grant, one-pager, tech report, system card, visual survey, datasheet: references/layout-patterns.md
- Corpus-informed design selection: references/arxiv-informed-design.md
- Package choices and load order: references/latex-packages.md
- Citations and bibliography flow: references/bibliography-citations.md
- Japanese typesetting details: references/japanese-typesetting.md
- Prompt patterns and response styles: references/prompt-pack.md
- Visual QA and rendered-page review: references/visual-qa.md
Build and portability
When the user asks for commands or setup help, prefer the bundled scripts.
Common commands
- Compile:
python scripts/latex_tool.py compile main.tex --outdir build - Review:
python scripts/latex_tool.py review main.tex --outdir build --review-dir review --strict - Render PDF pages:
python scripts/latex_tool.py render-review build/main.pdf --outdir review - Run PDF QA:
python scripts/latex_tool.py qa build/main.pdf --outdir review --strict - Watch:
python scripts/latex_tool.py watch main.tex --outdir build - Clean:
python scripts/latex_tool.py clean . - Environment check:
python scripts/latex_tool.py setup-check - Test all templates:
python scripts/latex_tool.py test-all --review - List templates:
python scripts/latex_tool.py list-templates - Scaffold a project:
python scripts/latex_tool.py scaffold techreport ./demo --with-assets --review - Study a PDF corpus:
python scripts/corpus_study.py --input-dir ./papers --outdir ./study
Wrapper scripts are also provided in scripts/ for .sh, .ps1, and .bat shells.
Response habits
- When the user is vague but clearly wants LaTeX, make a reasonable default choice and proceed.
- Ask follow-up questions only if missing information would materially change the class, engine, citation style, or required build flags.
- Prefer compile-ready code over prose-only explanations.
- Prefer fewer packages and clearer structure before advanced customization.
- State any external files, commands, or flags explicitly.
- For PDFs, mention whether the result should be visually reviewed before shipping.
Starter checklist for every answer
Before finishing, make sure the result:
- is syntactically valid LaTeX
- uses a suitable document class
- avoids unnecessary packages
- includes labels, captions, and bibliography hooks when relevant
- includes build commands when helpful
- includes review commands when the output is page-based
- stays editable for the user