latex
v1.0.0Write LaTeX documents with correct syntax, packages, and compilation workflow.
Installation
Please help me install the skill `latex` from SkillHub official store.
npx skills add ivangdavila/latex
Special Characters
- Reserved chars need escape:
# $ % & _ { } textbackslash - Tilde as character:
textasciitildenot~(that's an accent) - Caret:
textasciicircumnot^ - Backslash in text:
textbackslashnot\(that's line break)
Quotes & Dashes
- Opening quotes:
``not"; closing:''—never use straight"quotes - Hyphen
-, en-dash--(ranges: 1--10), em-dash---(punctuation) - Minus in math mode:
$-1$not-1in text
Math Mode
- Inline:
$...$or(...); display:[...]orequationenvironment - Text inside math:
$E = mc^2 text{ where } m text{ is mass}$ - Multiline equations:
alignenvironment, not multipleequations left( ... right)for auto-sizing delimiters—must be paired
Spacing
- Command followed by text needs
{}or:LaTeX{}orLaTeX is - Non-breaking space:
~between number and unit:5~km - Force space in math:
,thin,:medium,;thick,quadqquad
Packages
usepackageorder matters—hyperrefalmost always lastinputenc+fontencfor UTF-8:usepackage[utf8]{inputenc}usepackage[T1]{fontenc}graphicxfor images,booktabsfor professional tables,amsmathfor advanced mathmicrotypefor better typography—load early, subtle but significant improvement
Floats (Figures & Tables)
[htbp]suggests placement: here, top, bottom, page—not commands- LaTeX may move floats far from source—use
[H]fromfloatpackage to force - Always use
centeringinside float, notcenterenvironment - Caption before
label—label references the last numbered element
References
- Compile twice to resolve
refandpageref—first pass collects, second uses labelimmediately aftercaptionor inside environment being labeled- For bibliography: latex → bibtex → latex → latex (4 passes)
hyperrefmakes refs clickable—but can break with some packages
Tables
tabularfor inline,tablefloat for numbered with caption- Use
booktabs:toprule,midrule,bottomrule—no vertical lines @{}removes padding:begin{tabular}{@{}lll@{}}- Multicolumn:
multicolumn{2}{c}{Header}; multirow needsmultirowpackage
Images
- Path relative to main file or set with
graphicspath{{./images/}} - Prefer PDF/EPS for pdflatex/latex; PNG/JPG for photos
includegraphics[width=0.8textwidth]{file}—no extension often better
Common Errors
- Overfull hbox: line too long—rephrase, add
-hyphenation hints, or allowsloppy - Missing
$: math command used in text mode - Undefined control sequence: typo or missing package
includeadds page break,inputdoesn't—useinputfor fragments
Document Structure
- Preamble before
begin{document}—allusepackageand settings maketitleafterbegin{document}if usingtitle,author,datearticlefor short docs,reportfor chapters without parts,bookfor full books