Awesome-omni-skill latex
This skill should be used when the user asks to "create a LaTeX document", "convert markdown to LaTeX", "make a PDF from markdown", "format as LaTeX", "write LaTeX", or wants to produce beautifully typeset documents. Handles LaTeX generation from any input source with professional typography, and optionally compiles to PDF.
git clone https://github.com/diegosouzapw/awesome-omni-skill
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/development/latex" ~/.claude/skills/diegosouzapw-awesome-omni-skill-latex && rm -rf "$T"
skills/development/latex/SKILL.mdLaTeX Document Creator
Create beautifully formatted LaTeX documents from any input source (markdown files, plain text, structured data, or user instructions). Produce professional-quality typeset output following modern LaTeX best practices.
Workflow
- Analyze input - Read the source material, identify structure (headings, lists, tables, figures, math, code, citations)
- Determine document class - Select appropriate class based on content type and length
- Generate LaTeX - Produce a complete
file with proper preamble and body.tex - Compile to PDF (if requested) - Detect platform and compile using
latexmk
If the user provides additional formatting instructions, apply them. User instructions override defaults below.
Document Class Selection
| Content Type | Class | When |
|---|---|---|
| Short documents, articles, memos | | No chapters needed |
| Reports, theses, long documents | | Chapter-level structure |
| Books, manuals | | Front/back matter, parts |
| Presentations | | Slides |
Use KOMA-Script classes (
scrartcl, scrreprt, scrbook) over standard classes for superior typography defaults and built-in customization.
Standard Preamble
Organize the preamble in this order. Include only packages the document actually needs.
\documentclass[a4paper, 11pt]{scrartcl} % --- Typography --- \usepackage[T1]{fontenc} \usepackage{lmodern} % Clean, professional font \usepackage{microtype} % ESSENTIAL: character protrusion + font expansion % --- Math (include only if document has math) --- \usepackage{mathtools} % Superset of amsmath with fixes \usepackage{amssymb} % --- Layout --- \usepackage{geometry} % --- Tables & Figures --- \usepackage{booktabs} % Professional table rules \usepackage{graphicx} \usepackage{caption} \usepackage{subcaption} % --- Lists --- \usepackage{enumitem} % --- Language & Quotes --- \usepackage[english]{babel} \usepackage{csquotes} % --- Colors --- \usepackage{xcolor} % --- Code Listings (include only if document has code) --- \usepackage{listings} % --- Units (include only if document has quantities) --- \usepackage{siunitx} % --- Links & References (load near-last) --- \usepackage{hyperref} \hypersetup{ colorlinks=true, linkcolor=blue!70!black, citecolor=green!50!black, urlcolor=blue!70!black, } \usepackage{cleveref} % MUST be after hyperref
Package Notes
is non-negotiable for professional output - always include itmicrotype
loadsmathtools
automatically; never load bothamsmath
must load aftercleverefhyperref
should load near-lasthyperref- For bibliography: use
withbiblatex
backend, not legacybiber
/bibtexnatbib
Typography Rules
Fonts
- Default:
(Latin Modern) - clean, professional, widely availablelmodern - Alternative serif:
,libertinus
/newtxtext
(Times-like)newtxmath - For system fonts (Unicode): switch to LuaLaTeX with
fontspec
Spacing and Punctuation
- En-dash for ranges:
renders as 2020–20252020--2025 - Em-dash for breaks:
renders as word—wordword---word - Non-breaking space (
) before~
,\cite
, and between numbers and units\cref - Thin space before differentials:
\int f(x) \, dx - Use
from\enquote{}
for quotation marks, never manual quote characterscsquotes - Use
instead of\emph{}
- semantic emphasis that adapts to context\textit{} - Use
for ellipses, never three periods\dots
Sentence Spacing
- After abbreviations (not ending a sentence):
,e.g.\ thisi.e.\ that - After a capital letter ending a sentence:
NASA\@. The next sentence
Formatting Standards
Tables
- Always use
:booktabs
,\toprule
,\midrule\bottomrule - Never use vertical rules (
) or|\hline - Place table captions above the table
- Place figure captions below the figure
Figures
- Use
inside floats, not\centering\begin{center} - Default float placement:
[htbp] - Reference all figures in text before they appear
Cross-References
- Use
from\cref{}
- automatically produces "Figure 1", "Table 2", etc.cleveref - Label prefixes:
,fig:
,tab:
,sec:
,eq:lst: - Place
immediately after\label
or\caption\section
Lists
- Use
for customizationenumitem - Avoid nesting deeper than 3 levels - restructure content instead
Common Pitfalls to Avoid
- Never use
for display math - use$$...$$
or\[...\]
environmentequation - Never use
for paragraph breaks - use a blank line\\ - Never use
inside floats - use\begin{center}\centering - Never place
before\label
- produces wrong reference numbers\caption - Never hardcode reference numbers - always use
\cref{} - Never use bare function names in math - use
,\sin
, or\log\DeclareMathOperator - Escape special characters:
,#
,%
,$
,&
,_
,{}
Markdown-to-LaTeX Conversion
When converting from markdown, apply these mappings:
| Markdown | LaTeX |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
(horizontal rule) | |
| Tables | with rules |
| (same) |
| |
Conversion Guidelines
- Infer document title from the first
heading or filename# - Infer
and\author
if present in the source, otherwise omit\date - Preserve the semantic structure - do not flatten or over-nest headings
- Convert markdown tables to
-styledbooktabs
environmentstabular - Escape all LaTeX special characters in text content
- For documents with chapters, promote heading levels (
→#
,\chapter
→##
)\section
Compiling to PDF
When the user requests PDF output, detect the platform and compile.
Engine Selection
| Engine | Command | Use When |
|---|---|---|
| pdfLaTeX | | Default. ASCII/Latin content, standard fonts, fastest compilation |
| XeLaTeX | | System fonts via , native Unicode |
| LuaLaTeX | | System fonts + Lua scripting, no memory limits |
Using latexmk (Preferred)
latexmk automatically runs the correct number of passes for cross-references, bibliographies, and indices. Always prefer it over manual multi-pass compilation.
latexmk -pdf document.tex # Compile to PDF (pdflatex) latexmk -xelatex document.tex # Compile with XeTeX latexmk -lualatex document.tex # Compile with LuaTeX latexmk -c document.tex # Clean auxiliary files (keep PDF)
Manual Compilation (When latexmk Is Unavailable)
# Simple document (no bibliography) pdflatex document.tex && pdflatex document.tex # Document with biblatex/biber bibliography pdflatex document.tex && biber document && pdflatex document.tex && pdflatex document.tex
Platform-Specific Installation
If LaTeX tools are not installed or compilation fails due to missing packages, read the appropriate platform guide for installation instructions:
- Ubuntu/Debian: Read
references/pdf-compilation-ubuntu.md - macOS: Read
references/pdf-compilation-macos.md
Detect the platform with
uname -s (Linux or Darwin).
Package installation requires system permissions — present the installation command to the user and let them confirm before running
sudo or brew commands.